mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Use require_dependency in generated controllers
Using require in development mode will prevent required files from reloading, even if they're changed. In order to keep namespaced application_controller reloadable, we need to use require_dependency instead of require.
This commit is contained in:
parent
d22859ed97
commit
29d17d3ab6
3 changed files with 4 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
||||||
<% if namespaced? -%>
|
<% if namespaced? -%>
|
||||||
require "<%= namespaced_file_path %>/application_controller"
|
require_dependency "<%= namespaced_file_path %>/application_controller"
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
<% module_namespacing do -%>
|
<% module_namespacing do -%>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<% if namespaced? -%>
|
<% if namespaced? -%>
|
||||||
require "<%= namespaced_file_path %>/application_controller"
|
require_dependency "<%= namespaced_file_path %>/application_controller"
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
<% module_namespacing do -%>
|
<% module_namespacing do -%>
|
||||||
|
|
|
@ -21,7 +21,7 @@ class NamespacedControllerGeneratorTest < NamespacedGeneratorTestCase
|
||||||
def test_namespaced_controller_skeleton_is_created
|
def test_namespaced_controller_skeleton_is_created
|
||||||
run_generator
|
run_generator
|
||||||
assert_file "app/controllers/test_app/account_controller.rb",
|
assert_file "app/controllers/test_app/account_controller.rb",
|
||||||
/require "test_app\/application_controller"/,
|
/require_dependency "test_app\/application_controller"/,
|
||||||
/module TestApp/,
|
/module TestApp/,
|
||||||
/ class AccountController < ApplicationController/
|
/ class AccountController < ApplicationController/
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ class NamespacedScaffoldGeneratorTest < NamespacedGeneratorTestCase
|
||||||
|
|
||||||
# Controller
|
# Controller
|
||||||
assert_file "app/controllers/test_app/product_lines_controller.rb",
|
assert_file "app/controllers/test_app/product_lines_controller.rb",
|
||||||
/require "test_app\/application_controller"/,
|
/require_dependency "test_app\/application_controller"/,
|
||||||
/module TestApp/,
|
/module TestApp/,
|
||||||
/class ProductLinesController < ApplicationController/
|
/class ProductLinesController < ApplicationController/
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue