aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-03-19 06:06:20 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-03-19 06:06:20 +0000
commit5f4f4b03f2b5d4dd93388dd144166cd59593b0a9 (patch)
tree11497b5d468d0b3bec632dcc470d183eb065b58e
parent639ce3b21d92208c3ce7510f32d823219b69c4ec (diff)
downloadrails-5f4f4b03f2b5d4dd93388dd144166cd59593b0a9.tar.gz
rails-5f4f4b03f2b5d4dd93388dd144166cd59593b0a9.tar.bz2
rails-5f4f4b03f2b5d4dd93388dd144166cd59593b0a9.zip
Fix for destroying migrations made when generating a model (closes #4246) [tomtoday@gmail.com]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3971 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--railties/lib/rails_generator/commands.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/railties/lib/rails_generator/commands.rb b/railties/lib/rails_generator/commands.rb
index 3e02e3cc41..7ed461e58e 100644
--- a/railties/lib/rails_generator/commands.rb
+++ b/railties/lib/rails_generator/commands.rb
@@ -426,8 +426,11 @@ end_message
# When deleting a migration, it knows to delete every file named "[0-9]*_#{file_name}".
def migration_template(relative_source, relative_destination, template_options = {})
migration_directory relative_destination
- raise "There is no migration named #{file_name}" unless migration_exists?(file_name)
- existing_migrations(file_name).each do |file_path|
+
+ migration_file_name = template_options[:migration_file_name] || file_name
+ raise "There is no migration named #{migration_file_name}" unless migration_exists?(migration_file_name)
+
+ existing_migrations(migration_file_name).each do |file_path|
file(relative_source, file_path, template_options)
end
end