Permalink
Browse files

Updated genesis tasks file.

  • Loading branch information...
1 parent 9af7515 commit ae4fa867004086a66df39d5ee1a0828f5227db03 @midas committed Dec 12, 2009
Showing with 5 additions and 10 deletions.
  1. +5 −10 rails_generators/prepare_seeding/templates/genesis.rake
@@ -1,21 +1,16 @@
namespace :db do
desc "Loads seed data for the current environment."
task :genesis => :environment do
- fixtures = (Dir[File.join( RAILS_ROOT, 'db', 'seeds', '*.rb' )] + Dir[File.join( RAILS_ROOT, 'db', 'seeds', RAILS_ENV, '*.rb') ]).sort
- fixtures.each do |fixture|
- load fixture
- no_extension_name = fixture.gsub!( /.rb/, '' )
- class_name = no_extension_name.match( /\d*_(\w*)/ )[1].camelcase
- klass = class_name.constantize
- klass.up
- end
+ Genesis::Seeder.verify_or_create_version_table
+ ignores = %w()
+ seeds = Dir[File.join( RAILS_ROOT, 'db', 'seeds', '*.rb' )] +
+ Dir[File.join( RAILS_ROOT, 'db', 'seeds', RAILS_ENV, '*.rb') ]
+ Genesis::Seeder.run( seeds, ENV['VERSION'] || nil, ignores )
end
desc "Drops and recreates all tables along with seeding the database"
task :mulligan => :environment do
- ActiveRecord::Base.disable_observers
Rake::Task['db:migrate:reset'].invoke
- Rake::Task['db:version'].invoke
Rake::Task['db:genesis'].invoke
end
end

0 comments on commit ae4fa86

Please sign in to comment.