Permalink
Browse files

Change migration template name so that it can be easily used in tests

  • Loading branch information...
1 parent bae4321 commit 90be6a1514b186da00b316f2f80a3ed9d7aa1795 @obrie obrie committed Mar 1, 2010
@@ -1,7 +1,7 @@
class PreferencesGenerator < Rails::Generator::Base
def manifest
record do |m|
- m.migration_template 'migration.rb', 'db/migrate', :migration_file_name => 'create_preferences'
+ m.migration_template '001_create_preferences.rb', 'db/migrate', :migration_file_name => 'create_preferences'
end
end
end
@@ -1,12 +1,12 @@
class MigratePreferencesToVersion1 < ActiveRecord::Migration
def self.up
- ActiveRecord::Migrator.new(:up, "#{Rails.root}/../../db/migrate", 0).migrations.each do |migration|
+ ActiveRecord::Migrator.new(:up, "#{Rails.root}/../../generators/preferences/templates", 0).migrations.each do |migration|
migration.migrate(:up)
end
end
def self.down
- ActiveRecord::Migrator.new(:up, "#{Rails.root}/../../db/migrate", 0).migrations.each do |migration|
+ ActiveRecord::Migrator.new(:up, "#{Rails.root}/../../generators/preferences/templates", 0).migrations.each do |migration|
migration.migrate(:down)
end
end

0 comments on commit 90be6a1

Please sign in to comment.