aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/rails/generators/active_record/migration/templates/migration.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-11-17 14:57:46 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2010-11-17 14:57:54 -0800
commit4d35f8b6615d31fbed4806ee3c260e24447f435b (patch)
tree61fffc67fab357cf83549cb840ad0739e75fff56 /activerecord/lib/rails/generators/active_record/migration/templates/migration.rb
parentc1a63c8dba00b9f6ed81b3a46ecf595273cd876d (diff)
downloadrails-4d35f8b6615d31fbed4806ee3c260e24447f435b.tar.gz
rails-4d35f8b6615d31fbed4806ee3c260e24447f435b.tar.bz2
rails-4d35f8b6615d31fbed4806ee3c260e24447f435b.zip
updating generators
Diffstat (limited to 'activerecord/lib/rails/generators/active_record/migration/templates/migration.rb')
-rw-r--r--activerecord/lib/rails/generators/active_record/migration/templates/migration.rb4
1 files changed, 2 insertions, 2 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 8ac21c1410..126b6f434b 100644
--- a/activerecord/lib/rails/generators/active_record/migration/templates/migration.rb
+++ b/activerecord/lib/rails/generators/active_record/migration/templates/migration.rb
@@ -1,5 +1,5 @@
class <%= migration_class_name %> < ActiveRecord::Migration
- def self.up
+ def up
<% attributes.each do |attribute| -%>
<%- if migration_action -%>
<%= migration_action %>_column :<%= table_name %>, :<%= attribute.name %><% if migration_action == 'add' %>, :<%= attribute.type %><% end %>
@@ -7,7 +7,7 @@ class <%= migration_class_name %> < ActiveRecord::Migration
<%- end -%>
end
- def self.down
+ def 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 %>