Sha256: 562a8a5214961aab51a0290ae39d314651de7ec24f574b62a8f06da26a9f61f9
Contents?: true
Size: 626 Bytes
Versions: 13
Compression:
Stored size: 626 Bytes
Contents
require "sqlite3" ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:") ActiveRecord::Base.connection.tables.each do |table| ActiveRecord::Base.connection.drop_table(table, force: :cascade) end ActiveRecord::Schema.verbose = false ActiveRecord::Base.logger = Logger.new($stdout) ActiveRecord::Schema.define(version: 1) do create_table(:payments) do |t| t.belongs_to :user t.integer :amount t.timestamps end create_table(:users) end def fill_database 10.times do user = User.create! 10.times do Payment.create!(user: user, amount: rand(1000)) end end end
Version data entries
13 entries across 13 versions & 1 rubygems