Gill Bates
Gill Bates

Reputation: 47

rake db:fixtures:load on factory_girl

I used "rake db:fixtures:load" to insert dummy datas into development db. I start using factory_girl. Are there any way to insert datas in RAILS_ROOT/spec/factories/*.rb to development db?

Upvotes: 3

Views: 1025

Answers (1)

jbescoyez
jbescoyez

Reputation: 1393

Factories are not intended to fill the database. They will generate random data for your object attributes (unless otherwise specified). Hence, it won't fill the development database with defined data.

What you should use here are seeds. More info on:

http://ryandaigle.com/articles/2009/5/13/what-s-new-in-edge-rails-database-seeding and http://rails-bestpractices.com/posts/20-isolating-seed-data

Upvotes: 2

Related Questions