Created
July 23, 2020 00:00
-
-
Save fernandes/3c7a074f0de92e8965bc32d972a56121 to your computer and use it in GitHub Desktop.
AR in memory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "active_record" | |
require "sqlite3" | |
ActiveRecord::Base.establish_connection( | |
:adapter => 'sqlite3', | |
:host => "localhost", | |
:database => ':memory:' | |
) | |
ActiveRecord::Schema.define do | |
create_table :posts do |t| | |
t.column :title, :string | |
end | |
end | |
class Post < ActiveRecord::Base | |
end | |
Post.create!(title: 'foo') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment