Skip to content
This repository
Browse code

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
Łukasz Strzałkowski authored June 25, 2010 josevalim committed June 25, 2010
14  activerecord/lib/rails/generators/active_record/migration/templates/migration.rb
... ...
@@ -1,15 +1,17 @@
1 1
 class <%= migration_class_name %> < ActiveRecord::Migration
2  
-  def self.up<% attributes.each do |attribute| %>
3  
-    <%- if migration_action -%>
  2
+  def self.up
  3
+<% attributes.each do |attribute| %>
  4
+  <%- if migration_action -%>
4 5
     <%= migration_action %>_column :<%= table_name %>, :<%= attribute.name %><% if migration_action == 'add' %>, :<%= attribute.type %><% end %>
5  
-    <%- end -%>
6 6
   <%- end -%>
  7
+<%- end -%>
7 8
   end
8 9
 
9  
-  def self.down<% attributes.reverse.each do |attribute| %>
10  
-    <%- if migration_action -%>
  10
+  def self.down
  11
+<% attributes.reverse.each do |attribute| %>
  12
+  <%- if migration_action -%>
11 13
     <%= migration_action == 'add' ? 'remove' : 'add' %>_column :<%= table_name %>, :<%= attribute.name %><% if migration_action == 'remove' %>, :<%= attribute.type %><% end %>
12  
-    <%- end -%>
13 14
   <%- end -%>
  15
+<%- end -%>
14 16
   end
15 17
 end

0 notes on commit 518b16d

Please sign in to comment.
Something went wrong with that request. Please try again.