Populating the db with 1M rows
Reading on Rails and indexing associations. The author mentions writing 1M rows of dummmy data into the db for testing performance? How did he d开发者_StackOverflow中文版o this? Through an each loop in the seed.rb file? or is there a better way?
Gems like machinist do a good job of generating model instances for you. Particularly in conjunction with ffaker to give you all sorts of 'believable' test data.
You might also want to take a look at activerecord-import for mass-importing data. It will do bulk inserts when your database supports it (e.g. everything except for sqlite) and greatly speed them up.
He probably loaded data from a file. I like to use ruby to generate test data. (I don't do Rails development, but I have to do a lot of database testing.)
精彩评论