From 86d1dfb821dcc31897a0899e9b0933852d33cac3 Mon Sep 17 00:00:00 2001 From: Marcelo Silveira Date: Wed, 21 Mar 2012 19:28:34 -0300 Subject: Avoid another blank line in generated migration and remove assertion as per @spastorino request --- .../lib/rails/generators/active_record/migration/templates/migration.rb | 2 +- railties/test/generators/migration_generator_test.rb | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) 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 -- cgit v1.2.3