From 557014d45aeed82ed1e79b83ab59697392a1a5de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 24 Dec 2011 10:38:19 +0100 Subject: Tidy up migration types. --- .../rails/generators/active_record/migration/migration_generator.rb | 2 +- .../rails/generators/active_record/migration/templates/migration.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'activerecord/lib/rails/generators/active_record/migration') diff --git a/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb b/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb index 2db950fefb..1509e34473 100644 --- a/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb +++ b/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb @@ -3,7 +3,7 @@ require 'rails/generators/active_record' module ActiveRecord module Generators class MigrationGenerator < Base - argument :attributes, :type => :array, :default => [], :banner => "field:type field:type field:type:index" + argument :attributes, :type => :array, :default => [], :banner => "field[:type][:index] field[:type][:index]" def create_migration_file set_local_assigns! 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 53018ffc9a..d084a00ed7 100644 --- a/activerecord/lib/rails/generators/active_record/migration/templates/migration.rb +++ b/activerecord/lib/rails/generators/active_record/migration/templates/migration.rb @@ -4,7 +4,7 @@ class <%= migration_class_name %> < ActiveRecord::Migration <% attributes.each do |attribute| -%> add_column :<%= table_name %>, :<%= attribute.name %>, :<%= attribute.type %><%= attribute.inject_options %> <%- if attribute.has_index? -%> - add_index :<%= table_name %>, :<%= attribute.name %><%= attribute.inject_index_options %> + add_index :<%= table_name %>, :<%= attribute.index_name %><%= attribute.inject_index_options %> <%- end %> <%- end -%> end @@ -14,7 +14,7 @@ class <%= migration_class_name %> < ActiveRecord::Migration <%- if migration_action -%> <%= migration_action %>_column :<%= table_name %>, :<%= attribute.name %><% if migration_action == 'add' %>, :<%= attribute.type %><%= attribute.inject_options %><% end %> <% if attribute.has_index? && migration_action == 'add' %> - add_index :<%= table_name %>, :<%= attribute.name %><%= attribute.inject_index_options %> + add_index :<%= table_name %>, :<%= attribute.index_name %><%= attribute.inject_index_options %> <% end -%> <%- end -%> <%- end -%> -- cgit v1.2.3