Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix indenting in migration generator

    $ rails generate migration remove_foo_from_bars foo:string

This currently generates:

      def up
        remove_column :bars, :foo
          end

Fix it:

      def up
        remove_column :bars, :foo
      end
  • Loading branch information...
commit e5156c9564639cb58f1bf1240add8eb16bb52b57 1 parent 888fcca
@cbartlett cbartlett authored
View
4 activerecord/lib/rails/generators/active_record/migration/templates/migration.rb
@@ -13,9 +13,9 @@ def up
<% attributes.each do |attribute| -%>
<%- if migration_action -%>
<%= migration_action %>_column :<%= table_name %>, :<%= attribute.name %><% if migration_action == 'add' %>, :<%= attribute.type %><%= attribute.inject_options %><% end %>
- <% if attribute.has_index? && migration_action == 'add' %>
+ <%- if attribute.has_index? && migration_action == 'add' -%>
add_index :<%= table_name %>, :<%= attribute.index_name %><%= attribute.inject_index_options %>
- <% end -%>
+ <%- end -%>
<%- end -%>
<%- end -%>
end
Please sign in to comment.
Something went wrong with that request. Please try again.