diff options
author | José Valim <jose.valim@gmail.com> | 2011-12-24 10:38:19 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-12-24 10:52:45 +0100 |
commit | 557014d45aeed82ed1e79b83ab59697392a1a5de (patch) | |
tree | 9420f9c391624b13665b3c818cee815a9d016e71 /activerecord/lib/rails/generators/active_record/model/templates | |
parent | 7f5b51686c556e3a35a2e5320fe8e4d758ff70b5 (diff) | |
download | rails-557014d45aeed82ed1e79b83ab59697392a1a5de.tar.gz rails-557014d45aeed82ed1e79b83ab59697392a1a5de.tar.bz2 rails-557014d45aeed82ed1e79b83ab59697392a1a5de.zip |
Tidy up migration types.
Diffstat (limited to 'activerecord/lib/rails/generators/active_record/model/templates')
-rw-r--r-- | activerecord/lib/rails/generators/active_record/model/templates/migration.rb | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/activerecord/lib/rails/generators/active_record/model/templates/migration.rb b/activerecord/lib/rails/generators/active_record/model/templates/migration.rb index 0715d0262b..3a3cf86d73 100644 --- a/activerecord/lib/rails/generators/active_record/model/templates/migration.rb +++ b/activerecord/lib/rails/generators/active_record/model/templates/migration.rb @@ -8,13 +8,8 @@ class <%= migration_class_name %> < ActiveRecord::Migration t.timestamps <% end -%> end -<% if options[:indexes] -%> -<% attributes.select {|attr| attr.reference? }.each do |attribute| -%> - add_index :<%= table_name %>, :<%= attribute.name %>_id<%= attribute.inject_index_options %> -<% end -%> -<% end -%> -<% attributes.select {|attr| attr.has_index? }.each do |attribute| -%> - add_index :<%= table_name %>, :<%= attribute.name %><%= attribute.inject_index_options %> +<% attributes_with_index.each do |attribute| -%> + add_index :<%= table_name %>, :<%= attribute.index_name %><%= attribute.inject_index_options %> <% end -%> end end |