Skip to content

Instantly share code, notes, and snippets.

@brenttheisen
Created June 24, 2011 20:17
Show Gist options
  • Save brenttheisen/1045588 to your computer and use it in GitHub Desktop.
Save brenttheisen/1045588 to your computer and use it in GitHub Desktop.
Rake task that loads factories using factory_girl in to the current environment's database. Intended to be a replacement for Rail's rake db:fixtures:load.
#
# To install copy this file in to <RAILS_APP>/lib/tasks/factory_girl.rake.
# To use run: rake db:factory_girl_load
#
namespace :db do
namespace :factory_girl do
desc 'Load Factory Girl factories into the current environment\'s database.'
task :load => :environment do
FactoryGirl.registry.each do |(name, factory)|
FactoryGirl.build name
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment