aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/view_paths.rb
diff options
context:
space:
mode:
authorNick Sutterer <apotonick@gmail.com>2014-05-10 16:52:44 +1000
committerNick Sutterer <apotonick@gmail.com>2014-05-13 08:25:24 +1000
commitb8ad4b54730bf52fbaeb2d172229cc412fd60561 (patch)
tree24d59e5e48be63dd513e6eb6569dc421675cf5e9 /actionview/lib/action_view/view_paths.rb
parent67ec435cfbb1f8d929b62dd4e76e11f7e50aa9db (diff)
downloadrails-b8ad4b54730bf52fbaeb2d172229cc412fd60561.tar.gz
rails-b8ad4b54730bf52fbaeb2d172229cc412fd60561.tar.bz2
rails-b8ad4b54730bf52fbaeb2d172229cc412fd60561.zip
deprecate AbC:Base::parent_prefixes.
rename ::_local_prefixes to ::local_prefixes to state the public attribute. document the latter. make ::local_prefixes private, test overriding it and remove documentation for overriding ::_parent_prefixes.
Diffstat (limited to 'actionview/lib/action_view/view_paths.rb')
-rw-r--r--actionview/lib/action_view/view_paths.rb20
1 files changed, 16 insertions, 4 deletions
diff --git a/actionview/lib/action_view/view_paths.rb b/actionview/lib/action_view/view_paths.rb
index d96222e6dd..1fc4c7aa43 100644
--- a/actionview/lib/action_view/view_paths.rb
+++ b/actionview/lib/action_view/view_paths.rb
@@ -16,14 +16,26 @@ module ActionView
module ClassMethods
def _prefixes
@_prefixes ||= begin
- return _local_prefixes if superclass.abstract?
- _local_prefixes + superclass._prefixes
+ deprecated_prefixes = handle_deprecated_parent_prefixes and return deprecated_prefixes
+
+ return local_prefixes if superclass.abstract?
+ local_prefixes + superclass._prefixes
end
end
- def _local_prefixes
+ private
+
+ # Override this method in your controller if you want to change paths prefixes for finding views.
+ # Prefixes defined here will still be added to parents' <tt>::_prefixes</tt>.
+ def local_prefixes
[controller_path]
end
+
+ def handle_deprecated_parent_prefixes # TODO: remove in 4.3/5.0.
+ return unless respond_to?(:parent_prefixes)
+ ActiveSupport::Deprecation.warn "Overriding ActionController::Base::parent_prefixes is deprecated, override ::local_prefixes or ::_prefixes instead."
+ local_prefixes + parent_prefixes
+ end
end
# The prefixes used in render "foo" shortcuts.
@@ -88,4 +100,4 @@ module ActionView
end
end
end
-end
+end \ No newline at end of file