Seed your database with the Faker gem. Then seed 9.4x faster with upsert_all and activerecord-import.
21-Jul-2023 535
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 #database #Faker #faster #upsert_all #activerecord-import. #activerecord-import. #database #gem. https://rubyonrails.ba/link/seed-your-database-with-the-faker-gem-then-seed-9-4x-faster-with-upsert_all-and-activerecord-import