I have a large database I need to populate with data before initially running the application. Is it best to do this in an external rake task or inside migrations?
Sincerely,
Tyler
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The file
db/seeds.rbis designed for this purpose. It should have been generated automatically when you created the Rails project. It has a comment at the top that explains how to use it:After you’ve populated it, use
rake db:seedto populate the database with the seed data.