Created
June 8, 2009 21:04
-
-
Save johngrimes/126060 to your computer and use it in GitHub Desktop.
Rake task to load seed data from YAML files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :seed_data do | |
desc 'Load seed data into the database of the current environment' | |
task :load => :environment do | |
require 'active_record/fixtures' | |
Dir.glob(RAILS_ROOT + '/db/seed_data/*.yml').each do |file| | |
Fixtures.create_fixtures('db/seed_data', File.basename(file, '.*')) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment