From 518b16d9aedf4534b11aab8043d4efd0361fa1fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Strza=C5=82kowski?= Date: Fri, 25 Jun 2010 10:51:43 +0200 Subject: Line break in migration template and nicer code indentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Valim --- .../active_record/migration/templates/migration.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'activerecord/lib/rails/generators/active_record') 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 -- cgit v1.2.3