diff options
author | Fumiaki MATSUSHIMA <mtsmfm@gmail.com> | 2016-12-22 19:21:11 +0900 |
---|---|---|
committer | Fumiaki MATSUSHIMA <mtsmfm@gmail.com> | 2017-01-03 21:18:09 +0900 |
commit | 085546df456139b6c5d2cde964133e93a0818571 (patch) | |
tree | 1cf387116f32d69653126dd9e7c63bb10f197414 /activerecord/lib/rails/generators | |
parent | 33e60514aed85b3076f2636d5f1ccfb513aace1c (diff) | |
download | rails-085546df456139b6c5d2cde964133e93a0818571.tar.gz rails-085546df456139b6c5d2cde964133e93a0818571.tar.bz2 rails-085546df456139b6c5d2cde964133e93a0818571.zip |
Fix generator command for nested (namespaced) rails engine
If we create nested (namespaced) rails engine such like bukkits-admin,
`bin/rails g scaffold User name:string age:integer`
will create
`bukkits-admin/app/controllers/bukkits/users_controller.rb`
but it should create
`bukkits-admin/app/controllers/bukkits/admin/users_controller.rb`.
In #6643, we changed `namespaced_path` as root path
because we supposed application_controller is always in root
but nested rails engine's application_controller will not.
Diffstat (limited to 'activerecord/lib/rails/generators')
-rw-r--r-- | activerecord/lib/rails/generators/active_record/model/model_generator.rb | 2 |
1 files changed, 1 insertions, 1 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 61a8d3c100..cc78fe0db5 100644 --- a/activerecord/lib/rails/generators/active_record/model/model_generator.rb +++ b/activerecord/lib/rails/generators/active_record/model/model_generator.rb @@ -59,7 +59,7 @@ module ActiveRecord def application_record_file_name @application_record_file_name ||= if mountable_engine? - "app/models/#{namespaced_path}/application_record.rb" + File.join("app/models", namespaced_path, "application_record.rb") else "app/models/application_record.rb" end |