Model specific load devices

For automatic testing, RSpec and FactoryGirl are used.

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

The most convenient way to do this is with lights, because they handle relations between models very well.

I know that I can load fixtures using rake db: fixtures: load command , but sometimes I need to fill out only certain models (say, only customers → orders → products)

I am looking for a command, for example:

rake db:fixtures:load --models=customers,orders,products 
+7
source share
2 answers

You can use:

 rake db:fixtures:load FIXTURES=customers,orders,products 
+12
source

How about using the seed command?

 rake db:seed 

Here railscast explains this in detail:

http://railscasts.com/episodes/179-seed-data

http://asciicasts.com/episodes/179-seed-data

+1
source

All Articles