Permalink
Browse files

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.
  • Loading branch information...
drogus committed May 22, 2012
1 parent 5d6cca1 commit 56b86a377a9fa7d63a6fce1e5801c4910dfc703e
@@ -1,5 +1,5 @@
<% if namespaced? -%>
-require "<%= namespaced_file_path %>/application_controller"
+require_dependency "<%= namespaced_file_path %>/application_controller"
<% end -%>
<% module_namespacing do -%>
@@ -1,5 +1,5 @@
<% if namespaced? -%>
-require "<%= namespaced_file_path %>/application_controller"
+require_dependency "<%= namespaced_file_path %>/application_controller"
<% end -%>
<% module_namespacing do -%>
@@ -21,7 +21,7 @@ class NamespacedControllerGeneratorTest < NamespacedGeneratorTestCase
def test_namespaced_controller_skeleton_is_created
run_generator
assert_file "app/controllers/test_app/account_controller.rb",
- /require "test_app\/application_controller"/,
+ /require_dependency "test_app\/application_controller"/,
/module TestApp/,
/ class AccountController < ApplicationController/
@@ -229,7 +229,7 @@ def test_scaffold_on_invoke
# Controller
assert_file "app/controllers/test_app/product_lines_controller.rb",
- /require "test_app\/application_controller"/,
+ /require_dependency "test_app\/application_controller"/,
/module TestApp/,
/class ProductLinesController < ApplicationController/

0 comments on commit 56b86a3

Please sign in to comment.