Closed Mirv closed 7 years ago
Thanks for that i've been meaning to make a seeds file. When you say "delete all those migrations" is that in reference to all the files in the db>migrate folder?
Np.
Yes - I'm always fighting the migrations, if you have them archived already you can go back to them - keep committing your migrations and then delete them on the next?
I was going to add faker gem to generate random names - with your permission I'll go ahead and stick that in there at some point?
I put a basic file in
/db/seed.rb
for now, it sets up a user/pass & then creates a few recipes with their nested attributes.To run it ...
First, delete all those migrations - it's a timesink to trouble shoot them. Then...
rake db:reset
Which will unload the database, clearing everything out - then insert the data as fresh.
Optionally, you can ....
rake db:seed
Which will stack the old entries on top of the new - but you're going to get a validation issue in there too as it stands - which is why I've got this ticket open.
I need to put in a
rescue
in case of validation failing so the seeding process just keeps plugging along, instead of failing & cancelling all entries.