Skip to content

Instantly share code, notes, and snippets.

@johngrimes
Created June 8, 2009 21:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johngrimes/126060 to your computer and use it in GitHub Desktop.
Save johngrimes/126060 to your computer and use it in GitHub Desktop.
Rake task to load seed data from YAML files
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