How do I use a YAML file instead of seeds.rb to load the initial data into a database?
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.
Check out the Ruby on Rails Guide to fixtures:
http://guides.rubyonrails.org/testing.html#the-low-down-on-fixtures
Generally, you can create YAML fixture files in the
test/directory and then load them into your database using therake db:fixtures:loadcommand. The full documentation on all the cool things you can do with fixtures is here:http://api.rubyonrails.org/classes/Fixtures.html