Skip to content

Instantly share code, notes, and snippets.

@eonu
Last active July 30, 2019 09:20
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save eonu/bc186282352a740494ea05e29822841f to your computer and use it in GitHub Desktop.
ActiveRecord local test database
require 'active_record'
ENV['DATABASE_URL'] ||= "sqlite3:///path/to/db.sqlite3"
ActiveRecord::Base.establish_connection ENV['DATABASE_URL']
ActiveRecord::Schema.define do
self.verbose = true
create_table(:users, force: true) do |t|
t.string :username, null: false, unique: true
t.string :email, null: false
t.string :password_digest, null: false
t.timestamps
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment