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

你离开我真会死。 提交于 2019-12-04 12:54:20

问题


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)


回答1:


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.



来源:https://stackoverflow.com/questions/25818899/what-is-the-difference-between-rake-dbseed-and-rake-dbfixturesload

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!