diff options
Diffstat (limited to 'activerecord/lib/rails/generators/active_record/model/templates/migration.rb')
-rw-r--r-- | activerecord/lib/rails/generators/active_record/model/templates/migration.rb | 5 |
1 files changed, 2 insertions, 3 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 e573e908a7..4f81a52fd0 100644 --- a/activerecord/lib/rails/generators/active_record/model/templates/migration.rb +++ b/activerecord/lib/rails/generators/active_record/model/templates/migration.rb @@ -8,11 +8,10 @@ class <%= migration_class_name %> < ActiveRecord::Migration t.timestamps <% end -%> end - -<% if options[:indexes] %> +<% if options[:indexes] -%> <% attributes.select {|attr| attr.reference? }.each do |attribute| -%> add_index :<%= table_name %>, :<%= attribute.name %>_id <% end -%> -<% end %> +<% end -%> end end |