What is the difference between "rake db:seed" and rake db:fixtures:load"

jhstephenson picture jhstephenson · Sep 13, 2014 · Viewed 13k times · Source

I am new to Ruby and Rails and am curious about something.

In two different tutorials I am looking at they use different methods for populating a database with basic test information.

One uses "rake db:seed" to pull from a text file with sample data.

The other uses "rake db:fixtures:load".

To me they appear to do the exact same thing.

Do they, or am I missing something here? (Highly likely)

Answer

Jay Mitchell picture Jay Mitchell · Sep 13, 2014

rake db:seeds loads the data from db/seeds.rb into the database. This is generally used for development and production databases. It's permanent data that you use to start an empty application. More information here.

rake db:fixtures:load loads the test fixtures into the test database. This is temporary data used solely by the tests. You can think of fixtures as sample data.