Search code examples
ruby-on-railsdatabaseseeding

Reset the database (purge all), then seed a database


Is there a rake command to wipe out the data in the database tables?

How do I create a db:seed script to pre-fill data to my tables?


Solution

  • I use rake db:reset which drops and then recreates the database and includes your seeds.rb file. http://guides.rubyonrails.org/migrations.html#resetting-the-database