June 2024
Intermediate to advanced
456 pages
11h 34m
English
Earlier, in Chapter 3, Building a Performance-Testing Database, you learned tactics to create a scrubbed copy of a large database.
Having a scrubbed copy of your production database is a great solution if you’re able to set that up. A less complex alternative would be to use a small pre-production database and then populate it with large amounts of simulated data. Fortunately, you can do this using Active Record by way of the bulk insert methods.
Let’s try out the .insert_all[311] bulk insert method added to Active Record version 6. Rideshare has the following Rake task that inserts large batches of users with realistic-looking data supplied by the Faker[312] gem. Read this script and then run it. ...
Read now
Unlock full access