aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/rails/generators/active_record/model/model_generator.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-10-23 21:30:26 -0200
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-10-23 21:34:07 -0200
commitff044c3c3a0a85d26d7c000abeeed835a3bee0bf (patch)
treeb9a5c8a0f3caf46238b045c0fb5c93e7fb4136e7 /activerecord/lib/rails/generators/active_record/model/model_generator.rb
parentf0323288da939f57641b82041cb1a86a1e526746 (diff)
downloadrails-ff044c3c3a0a85d26d7c000abeeed835a3bee0bf.tar.gz
rails-ff044c3c3a0a85d26d7c000abeeed835a3bee0bf.tar.bz2
rails-ff044c3c3a0a85d26d7c000abeeed835a3bee0bf.zip
Use thor class_option to make the primary_key_type option work
Also move the method to the right class
Diffstat (limited to 'activerecord/lib/rails/generators/active_record/model/model_generator.rb')
-rw-r--r--activerecord/lib/rails/generators/active_record/model/model_generator.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/activerecord/lib/rails/generators/active_record/model/model_generator.rb b/activerecord/lib/rails/generators/active_record/model/model_generator.rb
index 7e8d68ce69..156f77e5eb 100644
--- a/activerecord/lib/rails/generators/active_record/model/model_generator.rb
+++ b/activerecord/lib/rails/generators/active_record/model/model_generator.rb
@@ -11,10 +11,9 @@ module ActiveRecord
class_option :timestamps, :type => :boolean
class_option :parent, :type => :string, :desc => "The parent class for the generated model"
class_option :indexes, :type => :boolean, :default => true, :desc => "Add indexes for references and belongs_to columns"
+ class_option :primary_key_type, type: :string, desc: "The type for primary key"
-
# creates the migration file for the model.
-
def create_migration_file
return unless options[:migration] && options[:parent].nil?
attributes.each { |a| a.attr_options.delete(:index) if a.reference? && !a.has_index? } if options[:indexes] == false