diff --git a/activerecord/lib/rails/generators/active_record/migration/templates/migration.rb b/activerecord/lib/rails/generators/active_record/migration/templates/migration.rb index 85f0d43b77..9ca63a209e 100644 --- a/activerecord/lib/rails/generators/active_record/migration/templates/migration.rb +++ b/activerecord/lib/rails/generators/active_record/migration/templates/migration.rb @@ -26,7 +26,7 @@ class <%= migration_class_name %> < ActiveRecord::Migration <%= migration_action == 'add' ? 'remove' : 'add' %>_column :<%= table_name %>, :<%= attribute.name %><% if migration_action == 'remove' %>, :<%= attribute.type %><%= attribute.inject_options %><% end %> <%- if attribute.has_index? && migration_action == 'remove' -%> add_index :<%= table_name %>, :<%= attribute.index_name %><%= attribute.inject_index_options %> - <%- end %> + <%- end -%> <%- end -%> <%- end -%> end diff --git a/railties/test/generators/migration_generator_test.rb b/railties/test/generators/migration_generator_test.rb index ad54f321a5..fd84164340 100644 --- a/railties/test/generators/migration_generator_test.rb +++ b/railties/test/generators/migration_generator_test.rb @@ -37,7 +37,6 @@ class MigrationGeneratorTest < Rails::Generators::TestCase assert_method :change, content do |up| assert_match(/add_column :posts, :title, :string/, up) assert_match(/add_column :posts, :body, :text/, up) - assert_no_match(/\n\n/, up) end end end