Sha256: da5ac1e3248839d4939f27d04440b37e66666f7c77957840d5db496a966de274
Contents?: true
Size: 941 Bytes
Versions: 5
Compression:
Stored size: 941 Bytes
Contents
namespace :db do desc "Populate database" task populate: :environment do full_reset Entity.create(title: 'test_title 1', amount: 430, kind: 1, status: 'active', confirmed: true, created_at: Time.current - 3.days) Entity.create(title: 'test_title 2', amount: 123, kind: 2, status: 'active', confirmed: true, created_at: Time.current - 5.days) Entity.create(title: 'test_title 3', amount: 20, kind: 4, status: 'inactive', confirmed: false, created_at: Time.current - 10.days) Entity.create(title: 'test_title 4', amount: 50, kind: 2, status: 'inactive', confirmed: true, created_at: Time.current) Entity.create(title: 'test_title 5', amount: 75, kind: 2, status: 'inactive', confirmed: true, created_at: Time.current - 2.days) end def full_reset Rake::Task['db:reset'].invoke end def dummy title, number=1 puts "Creating dummy #{title}..." number.times { yield } puts "...done" end end
Version data entries
5 entries across 5 versions & 1 rubygems