"rake db:seed"和"rake db:seed"之间有什么区别?并耙db:fixtures:load“ [英] What is the difference between "rake db:seed" and rake db:fixtures:load"
问题描述
我是Ruby和Rails的新手,并对某些事情感到好奇.
在两个不同的教程中,我正在研究它们使用不同的方法用基本测试信息填充数据库.
使用"rake db:seed"从带有示例数据的文本文件中提取.
另一个使用"rake db:fixtures:load".
对我来说,他们似乎做的完全一样.
是他们,还是我在这里想念什么? (很有可能)
此处.
rake db:fixtures:load
将测试装置加载到测试数据库中.这是仅由测试使用的临时数据.您可以将灯具视为样本数据.>
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)
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.
这篇关于"rake db:seed"和"rake db:seed"之间有什么区别?并耙db:fixtures:load“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!