aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/rails
diff options
context:
space:
mode:
authorŁukasz Strzałkowski <lukasz.strzalkowski@gmail.com>2010-06-25 10:51:43 +0200
committerJosé Valim <jose.valim@gmail.com>2010-06-25 10:57:05 +0200
commit518b16d9aedf4534b11aab8043d4efd0361fa1fd (patch)
tree575c0e79e181bfcb1c4c4320f437638aab479598 /activerecord/lib/rails
parentb01df28413be0add0876de6406be9c02d4b96f4c (diff)
downloadrails-518b16d9aedf4534b11aab8043d4efd0361fa1fd.tar.gz
rails-518b16d9aedf4534b11aab8043d4efd0361fa1fd.tar.bz2
rails-518b16d9aedf4534b11aab8043d4efd0361fa1fd.zip
Line break in migration template and nicer code indentation
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activerecord/lib/rails')
-rw-r--r--activerecord/lib/rails/generators/active_record/migration/templates/migration.rb14
1 files changed, 8 insertions, 6 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 d6ab3257a0..edc6a18d5d 100644
--- a/activerecord/lib/rails/generators/active_record/migration/templates/migration.rb
+++ b/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