Reputation: 12789
rake db:seed
Does rerunning seed data drop the existing seed data and re-create or adds just the new records whenever you modify the seed data?
Upvotes: 4
Views: 1217
Reputation: 32629
When you run rake db:seed
, db/seeds.rb is only included with the rails environment.
Therefore, nothing else is done on your database than what you mention it to do.
I usually put the following at the top of my db/seeds file :
Dir['app/models/**/*.rb'].each do |model|
model_object = model.camelize.constantize
model_object.delete_all
end
This way, all previous seed data is removed, and I get this fresh new proper data I want in my dev environment.
Upvotes: 3