diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2016-05-17 16:53:20 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2016-05-20 18:30:34 -0700 |
commit | 0ce7eae7418f1b9bb06b351c1f26d50c3674c0d0 (patch) | |
tree | 376411b06eefbfde4972fe910b0d88e5ea13229c | |
parent | 5929853524d350a846111666303cb2f8a8507024 (diff) | |
download | rails-0ce7eae7418f1b9bb06b351c1f26d50c3674c0d0.tar.gz rails-0ce7eae7418f1b9bb06b351c1f26d50c3674c0d0.tar.bz2 rails-0ce7eae7418f1b9bb06b351c1f26d50c3674c0d0.zip |
Make sure the cache is always populated
This way we don't have to make multiple calls on anonymous controllers
-rw-r--r-- | actionpack/lib/abstract_controller/base.rb | 6 | ||||
-rw-r--r-- | actionview/lib/action_view/test_case.rb | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/actionpack/lib/abstract_controller/base.rb b/actionpack/lib/abstract_controller/base.rb index d4317399ed..e90886775e 100644 --- a/actionpack/lib/abstract_controller/base.rb +++ b/actionpack/lib/abstract_controller/base.rb @@ -94,7 +94,11 @@ module AbstractController # ==== Returns # * <tt>String</tt> def controller_path - @controller_path ||= name.sub(/Controller$/, ''.freeze).underscore unless anonymous? + @controller_path ||= if anonymous? + superclass.controller_path + else + name.sub(/Controller$/, ''.freeze).underscore + end end # Refresh the cached action_methods when a new action_method is added. diff --git a/actionview/lib/action_view/test_case.rb b/actionview/lib/action_view/test_case.rb index 120962b5aa..ec16b0609e 100644 --- a/actionview/lib/action_view/test_case.rb +++ b/actionview/lib/action_view/test_case.rb @@ -14,7 +14,7 @@ module ActionView attr_accessor :request, :response, :params class << self - attr_writer :controller_path + attr_accessor :controller_path end def controller_path=(path) |