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
上级 639ce3b2
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册