Seed your database with the Faker gem. Then seed 9.4x faster with upsert_all and activerecord-import.

I cover 3 things in this article —Using the faker gem in a Rails app to seed 10,000 fake records.Fixing our slow seeds by making them 9.4x faster, using upsert_all or the activerecord-import gem (since our naive method is very inefficient).Finally, I show you how to split your database seeds into 3 separate files — one file for each Rails environment. This way, you won't seed your production database with lots of faker generated records.
Seed your database with the Faker gem. Then seed 9.4x faster with upsert_all and activerecord-import. #ruby #rubydeveloper #rubyonrails #activerecord-import. #database #gem. https://www.rubyonrails.ba/single/seed-your-database-with-the-faker-gem-then-seed-9-4x-faster-with-upsert_all-and-activerecord-import

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles