I have a few tables that I would like to add about 10 rows of data to, in a manner that respects and illustrates their relationships.
-
How can I add seed data (dummy data) to my applications’ development database for testing?
I’m hoping someone could point me to a rails friendly method for doing this. -
Is there an easy way to make the CRUD methods in each table perspective controllers?
This is what the
db/seeds.rbfile is for.You can execute it with rake db:seed
The default contents of seeds.rb
You can use ruby in this, so to insert 10 users: