Skip to content

Instantly share code, notes, and snippets.

@stevebartholomew
Created May 14, 2009 22:50
Show Gist options
  • Save stevebartholomew/111975 to your computer and use it in GitHub Desktop.
Save stevebartholomew/111975 to your computer and use it in GitHub Desktop.
namespace :db do
desc "Reset database and load seed data"
task :seed do
Rake::Task["db:migrate:reset"].invoke
require 'active_record/fixtures'
ActiveRecord::Base.establish_connection(RAILS_ENV.to_sym)
Dir.glob(File.join(RAILS_ROOT, 'db', 'seed', '*.{yml,csv}')).each do |fixture_file|
Fixtures.create_fixtures('db/seed', File.basename(fixture_file, '.*'))
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment