Skip to content

Commit

Permalink
Fix for destroying migrations made when generating a model (closes #4246
Browse files Browse the repository at this point in the history
) [tomtoday@gmail.com]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3971 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
dhh committed Mar 19, 2006
1 parent 639ce3b commit 5f4f4b0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions railties/lib/rails_generator/commands.rb
Expand Up @@ -426,8 +426,11 @@ def complex_template(*args)
# 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
Expand Down

0 comments on commit 5f4f4b0

Please sign in to comment.