How can I use FactoryBot in db/seeds?

fespinozacast picture fespinozacast · Mar 21, 2011 · Viewed 15.6k times · Source

Is it possible to do this?

If so, how can you do it?

Note: FactoryBot was previously named FactoryGirl

Answer

Michael Greenly picture Michael Greenly · Sep 13, 2011

All you need to do is add require 'factory_bot_rails' to the db/seeds.rb file. This will give you access to your factories.

Note: Gem was previously called FactoryGirlRails