diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2016-06-13 11:24:33 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-13 11:24:33 -0400 |
commit | a9734859ce3b07a27f58169ec85fe8e3fc4b20fd (patch) | |
tree | ddc804a7fda9b320f0075fde4e7e50b6f21d43e0 /activerecord/lib/rails/generators/active_record | |
parent | 1efc81ba8fe27e406bdb2de104234253b47ddc2f (diff) | |
parent | b991017bf1bfc2a9ca56f8b475f6f47b3ce99484 (diff) | |
download | rails-a9734859ce3b07a27f58169ec85fe8e3fc4b20fd.tar.gz rails-a9734859ce3b07a27f58169ec85fe8e3fc4b20fd.tar.bz2 rails-a9734859ce3b07a27f58169ec85fe8e3fc4b20fd.zip |
Merge pull request #25319 from morgoth/generate-application-record-first
Generate application_record.rb file before model file
Diffstat (limited to 'activerecord/lib/rails/generators/active_record')
-rw-r--r-- | activerecord/lib/rails/generators/active_record/model/model_generator.rb | 12 |
1 files changed, 2 insertions, 10 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 f191eff5bf..2ebdf3c19e 100644 --- a/activerecord/lib/rails/generators/active_record/model/model_generator.rb +++ b/activerecord/lib/rails/generators/active_record/model/model_generator.rb @@ -21,8 +21,8 @@ module ActiveRecord end def create_model_file - template 'model.rb', File.join('app/models', class_path, "#{file_name}.rb") generate_application_record + template 'model.rb', File.join('app/models', class_path, "#{file_name}.rb") end def create_module_file @@ -48,7 +48,7 @@ module ActiveRecord # Used by the migration template to determine the parent name of the model def parent_class_name - options[:parent] || determine_default_parent_class + options[:parent] || "ApplicationRecord" end def application_record_exist? @@ -64,14 +64,6 @@ module ActiveRecord 'app/models/application_record.rb' end end - - def determine_default_parent_class - if application_record_exist? - "ApplicationRecord" - else - "ActiveRecord::Base" - end - end end end end |