diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2017-01-03 21:51:18 -0500 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2017-01-03 21:51:18 -0500 |
commit | b6ffb5efcb694a9302453b8d2081f02090a90c62 (patch) | |
tree | 7a3e0bcf4cf862bcde23c9420c39a9fb9e13dc77 /railties | |
parent | 1e969bfb98b88799e2c759fce25a1d8cf00d7ce7 (diff) | |
download | rails-b6ffb5efcb694a9302453b8d2081f02090a90c62.tar.gz rails-b6ffb5efcb694a9302453b8d2081f02090a90c62.tar.bz2 rails-b6ffb5efcb694a9302453b8d2081f02090a90c62.zip |
Revert "Merge pull request #27550 from mtsmfm/fix-generator-command-for-nested-rails-engine"
This reverts commit 1e969bfb98b88799e2c759fce25a1d8cf00d7ce7, reversing
changes made to a5041f267ded119c2d00b8786c2f2c1e3f93c8a1.
Reason: It breaks the public API
Diffstat (limited to 'railties')
6 files changed, 6 insertions, 26 deletions
diff --git a/railties/lib/rails/generators/named_base.rb b/railties/lib/rails/generators/named_base.rb index 844630be1e..e3660b012a 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("::").map(&:underscore) + @namespaced_path ||= namespace.name.split("::").first.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 de6f664eb1..633e0b3177 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 "<%= File.join(namespaced_path) %>/application_controller" +require_dependency "<%= 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 86a3e12790..400afec6dc 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 "<%= File.join(namespaced_path) %>/application_controller" +require_dependency "<%= 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 e1adc11efd..42b9e34274 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 "<%= File.join(namespaced_path) %>/application_controller" +require_dependency "<%= 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 c5433c1bc2..8840a86d0d 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.join("_"), table_name] + "%s_%s" % [namespaced_path, table_name] else table_name end diff --git a/railties/test/generators/scaffold_generator_test.rb b/railties/test/generators/scaffold_generator_test.rb index e2b2acab0f..6b7e2c91d7 100644 --- a/railties/test/generators/scaffold_generator_test.rb +++ b/railties/test/generators/scaffold_generator_test.rb @@ -492,26 +492,6 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase end end - def test_scaffold_tests_pass_by_default_inside_namespaced_mountable_engine - Dir.chdir(destination_root) { `bundle exec rails plugin new bukkits-admin --mountable` } - - engine_path = File.join(destination_root, "bukkits-admin") - - Dir.chdir(engine_path) do - quietly do - `bin/rails g scaffold User name:string age:integer; - bin/rails db:migrate` - end - - assert_file "bukkits-admin/app/controllers/bukkits/admin/users_controller.rb" do |content| - assert_match(/module Bukkits::Admin/, content) - assert_match(/class UsersController < ApplicationController/, content) - end - - assert_match(/8 runs, 10 assertions, 0 failures, 0 errors/, `bin/rails test 2>&1`) - end - end - def test_scaffold_tests_pass_by_default_inside_full_engine Dir.chdir(destination_root) { `bundle exec rails plugin new bukkits --full` } |