diff options
author | José Valim <jose.valim@gmail.com> | 2011-05-04 11:26:02 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-05-04 11:28:37 +0200 |
commit | 6afc900191c8edc6f41966827e1cd03ced3f1b17 (patch) | |
tree | 9b1e65ffc67052c455ab5c5b98c90d888abd90a3 /actionpack/lib/abstract_controller/view_paths.rb | |
parent | d9c39c3ae9aa9d0f50a4b557781be39e39e5b752 (diff) | |
download | rails-6afc900191c8edc6f41966827e1cd03ced3f1b17.tar.gz rails-6afc900191c8edc6f41966827e1cd03ced3f1b17.tar.bz2 rails-6afc900191c8edc6f41966827e1cd03ced3f1b17.zip |
Move prefixes to view paths as they are now a lookup context dependency.
Diffstat (limited to 'actionpack/lib/abstract_controller/view_paths.rb')
-rw-r--r-- | actionpack/lib/abstract_controller/view_paths.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/actionpack/lib/abstract_controller/view_paths.rb b/actionpack/lib/abstract_controller/view_paths.rb index a777cf866d..0893459e24 100644 --- a/actionpack/lib/abstract_controller/view_paths.rb +++ b/actionpack/lib/abstract_controller/view_paths.rb @@ -11,6 +11,30 @@ module AbstractController delegate :find_template, :template_exists?, :view_paths, :formats, :formats=, :locale, :locale=, :to => :lookup_context + module ClassMethods + def parent_prefixes + @parent_prefixes ||= begin + parent_controller = superclass + prefixes = [] + + until parent_controller.abstract? + prefixes << parent_controller.controller_path + parent_controller = parent_controller.superclass + end + + prefixes + end + end + end + + # The prefixes used in render "foo" shortcuts. + def _prefixes + @_prefixes ||= begin + parent_prefixes = self.class.parent_prefixes + parent_prefixes.dup.unshift(controller_path) + end + end + # LookupContext is the object responsible to hold all information required to lookup # templates, i.e. view paths and details. Check ActionView::LookupContext for more # information. |