From 2e8146909a08d802f6fb138e666593d7a0887d18 Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Sun, 20 Sep 2015 16:02:39 +0900 Subject: fix application_controller require_dependency path generated by the scaffold generator This is follow up to #6643. In #6643, the controller generator only had been fixed, in this commit to fix the scaffold generator. --- .../rails/generators/rails/scaffold_controller/templates/controller.rb | 2 +- railties/test/generators/namespaced_generators_test.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) 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 2c3b04043f..f73e9a96ba 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_file_path %>/application_controller" +require_dependency "<%= namespaced_path %>/application_controller" <% end -%> <% module_namespacing do -%> diff --git a/railties/test/generators/namespaced_generators_test.rb b/railties/test/generators/namespaced_generators_test.rb index e839b67960..c4ee6602c5 100644 --- a/railties/test/generators/namespaced_generators_test.rb +++ b/railties/test/generators/namespaced_generators_test.rb @@ -281,6 +281,7 @@ class NamespacedScaffoldGeneratorTest < NamespacedGeneratorTestCase # Controller assert_file "app/controllers/test_app/admin/roles_controller.rb" do |content| assert_match(/module TestApp\n class Admin::RolesController < ApplicationController/, content) + assert_match(%r(require_dependency "test_app/application_controller"), content) end assert_file "test/controllers/test_app/admin/roles_controller_test.rb", -- cgit v1.2.3