diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2017-01-03 21:45:25 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-03 21:45:25 -0500 |
commit | 1e969bfb98b88799e2c759fce25a1d8cf00d7ce7 (patch) | |
tree | 289fe880144145088e3839074b691ba35b78a1b5 /railties/lib | |
parent | a5041f267ded119c2d00b8786c2f2c1e3f93c8a1 (diff) | |
parent | 085546df456139b6c5d2cde964133e93a0818571 (diff) | |
download | rails-1e969bfb98b88799e2c759fce25a1d8cf00d7ce7.tar.gz rails-1e969bfb98b88799e2c759fce25a1d8cf00d7ce7.tar.bz2 rails-1e969bfb98b88799e2c759fce25a1d8cf00d7ce7.zip |
Merge pull request #27550 from mtsmfm/fix-generator-command-for-nested-rails-engine
Fix generator command for nested (namespaced) rails engine
Diffstat (limited to 'railties/lib')
5 files changed, 6 insertions, 6 deletions
diff --git a/railties/lib/rails/generators/named_base.rb b/railties/lib/rails/generators/named_base.rb index e3660b012a..844630be1e 100644 --- a/railties/lib/rails/generators/named_base.rb +++ b/railties/lib/rails/generators/named_base.rb @@ -95,11 +95,11 @@ module Rails end def namespaced_class_path # :doc: - @namespaced_class_path ||= [namespaced_path] + @class_path + @namespaced_class_path ||= namespaced_path + @class_path end def namespaced_path # :doc: - @namespaced_path ||= namespace.name.split("::").first.underscore + @namespaced_path ||= namespace.name.split("::").map(&:underscore) end def class_name # :doc: diff --git a/railties/lib/rails/generators/rails/controller/templates/controller.rb b/railties/lib/rails/generators/rails/controller/templates/controller.rb index 633e0b3177..de6f664eb1 100644 --- a/railties/lib/rails/generators/rails/controller/templates/controller.rb +++ b/railties/lib/rails/generators/rails/controller/templates/controller.rb @@ -1,5 +1,5 @@ <% if namespaced? -%> -require_dependency "<%= namespaced_path %>/application_controller" +require_dependency "<%= File.join(namespaced_path) %>/application_controller" <% end -%> <% module_namespacing do -%> diff --git a/railties/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb b/railties/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb index 400afec6dc..86a3e12790 100644 --- a/railties/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb +++ b/railties/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb @@ -1,5 +1,5 @@ <% if namespaced? -%> -require_dependency "<%= namespaced_path %>/application_controller" +require_dependency "<%= File.join(namespaced_path) %>/application_controller" <% end -%> <% module_namespacing do -%> diff --git a/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb b/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb index 42b9e34274..e1adc11efd 100644 --- a/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb +++ b/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb @@ -1,5 +1,5 @@ <% if namespaced? -%> -require_dependency "<%= namespaced_path %>/application_controller" +require_dependency "<%= File.join(namespaced_path) %>/application_controller" <% end -%> <% module_namespacing do -%> diff --git a/railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb b/railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb index 8840a86d0d..c5433c1bc2 100644 --- a/railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +++ b/railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb @@ -22,7 +22,7 @@ module TestUnit # :nodoc: def fixture_name @fixture_name ||= if mountable_engine? - "%s_%s" % [namespaced_path, table_name] + "%s_%s" % [namespaced_path.join("_"), table_name] else table_name end |