Skip to content

Instantly share code, notes, and snippets.

View andreibondarev's full-sized avatar
🛠️
Building

Andrei Bondarev andreibondarev

🛠️
Building
View GitHub Profile
@andreibondarev
andreibondarev / create_schema.rb
Last active October 2, 2023 23:26
Code for "Adding Intelligent Search to a Rails application with Weaviate"
require "weaviate"
client = Weaviate::Client.new(
url: ENV['WEAVIATE_URL'],
api_key: ENV['WEAVIATE_API_KEY'],
# Configure Weaviate to use OpenAI to create vectors and use it for querying
# You can also use Cohere or Hugging Face and pass their API key here instead
model_service: :openai,
model_service_api_key: ENV['OPENAI_API_KEY']

Ruby on Rails Website Launch Checklist

Copy this gist and customise it to your liking.

  • Run Brakeman and resolve any issues where required
  • Run rails best practices and resolve any warnings
  • Run full test suite and make sure all tests are passing
  • Make sure no dummy email addresses are left in any notification emails (eg contact form)
  • Make sure production assets compile correct (eg files in vendor, etc, compile and are not 404'ing in production environment)
  • If using unicorn in production, make sure deploys are restarting the unicorns

Domain Modeling and Databases

Learning Objectives

  • Describe the basic parts of an ERD
  • Construct ERDs to model the nouns and relationships in a domain
  • Explain what a database is and why you would use one as opposed to other persistent storage mechanisms
  • Explain the difference between a database management system (R/DBMS) and a database, and name the major DBMSes
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
# 1) Use VCR.use_cassette in your let block. This will use
# the cassette just for requests made by creating bar, not
# for anything else in your test.
let(:foo) { VCR.use_cassette("foo") { create(:bar) } }
it "uses foo" do
foo
end
# 2) Wrap the it block that uses #foo in VCR.use_cassette.