diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-10-23 21:30:26 -0200 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-10-23 21:34:07 -0200 |
commit | ff044c3c3a0a85d26d7c000abeeed835a3bee0bf (patch) | |
tree | b9a5c8a0f3caf46238b045c0fb5c93e7fb4136e7 /activerecord/lib/rails/generators/active_record/model/model_generator.rb | |
parent | f0323288da939f57641b82041cb1a86a1e526746 (diff) | |
download | rails-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.rb | 3 |
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 |