how to save data into database when rails migration run. I have records of city and i would like to save data into databases when i create a table.
Share
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
db/seeds.rbfile is there so you can add seeded data to your database. You can create your records inside of there using ActiveRecord (it is just a ruby file):You can populate your database with your seeds by running
rake db:seed. You can also chain your migration/seed commands together: