Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Line break in migration template and nicer code indentation

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
commit 518b16d9aedf4534b11aab8043d4efd0361fa1fd 1 parent b01df28
@strzalek strzalek authored josevalim committed
View
14 activerecord/lib/rails/generators/active_record/migration/templates/migration.rb
@@ -1,15 +1,17 @@
class <%= migration_class_name %> < ActiveRecord::Migration
- def self.up<% attributes.each do |attribute| %>
- <%- if migration_action -%>
+ def self.up
+<% attributes.each do |attribute| %>
+ <%- if migration_action -%>
<%= migration_action %>_column :<%= table_name %>, :<%= attribute.name %><% if migration_action == 'add' %>, :<%= attribute.type %><% end %>
- <%- end -%>
<%- end -%>
+<%- end -%>
end
- def self.down<% attributes.reverse.each do |attribute| %>
- <%- if migration_action -%>
+ def self.down
+<% attributes.reverse.each do |attribute| %>
+ <%- if migration_action -%>
<%= migration_action == 'add' ? 'remove' : 'add' %>_column :<%= table_name %>, :<%= attribute.name %><% if migration_action == 'remove' %>, :<%= attribute.type %><% end %>
- <%- end -%>
<%- end -%>
+<%- end -%>
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.