Permalink
Browse files

Merge pull request #6643 from fredwu/fix_require_dependency

Fixed the application_controller require_dependency path generated by the app generator
  • Loading branch information...
2 parents 870310d + 686966a commit 7682f7004d8ece950b295e9edd8e3e039e486ab2 @josevalim josevalim committed Jun 6, 2012
@@ -84,10 +84,11 @@ def namespaced_file_path
end
def namespaced_class_path
- @namespaced_class_path ||= begin
- namespace_path = namespace.name.split("::").map {|m| m.underscore }
- namespace_path + @class_path
- end
+ @namespaced_class_path ||= [namespace_path] + @class_path
+ end
+
+ def namespace_path
+ @namespace_path ||= namespace.name.split("::").map {|m| m.underscore }[0]
end
def class_name
@@ -1,5 +1,5 @@
<% if namespaced? -%>
-require_dependency "<%= namespaced_file_path %>/application_controller"
+require_dependency "<%= namespace_path %>/application_controller"
<% end -%>
<% module_namespacing do -%>
@@ -38,7 +38,9 @@ def test_skipping_namespace
def test_namespaced_controller_with_additional_namespace
run_generator ["admin/account"]
- assert_file "app/controllers/test_app/admin/account_controller.rb", /module TestApp/, / class Admin::AccountController < ApplicationController/
+ assert_file "app/controllers/test_app/admin/account_controller.rb", /module TestApp/, / class Admin::AccountController < ApplicationController/ do |contents|
+ assert_match %r(require_dependency "test_app/application_controller"), contents
+ end
end
def test_helpr_is_also_namespaced

0 comments on commit 7682f70

Please sign in to comment.