Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load fixtures for specific model

For automated testing, RSpec and FactoryGirl are used.

Frequently, I need to manually play with my application. So, i need a convenient way to populate database with some data.

The most convenient way to do it - is fixtures, because they handling relationships between models very well.

I know, that i can load fixtures via rake db:fixtures:load command, but sometimes i need to populate only specific models (say, only customers --> orders --> products)

I'm looking for a command, like this:

rake db:fixtures:load --models=customers,orders,products
like image 203
AntonAL Avatar asked May 19 '11 16:05

AntonAL


1 Answers

You can use:

rake db:fixtures:load FIXTURES=customers,orders,products
like image 99
Shadwell Avatar answered Oct 10 '22 15:10

Shadwell