aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/abstract_controller/rendering_controller.rb
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2009-08-17 19:46:06 -0300
committerEmilio Tagua <miloops@gmail.com>2009-08-17 19:46:06 -0300
commitc01c8967a02537f132d437d5ae15332982119651 (patch)
tree76ed47f6bffd5fe1aa11c65cd32b222d881f43aa /actionpack/lib/abstract_controller/rendering_controller.rb
parent770fca10fba68fa14308f33e923493e6f63bfa35 (diff)
parentccf28d2499d1b4e2aba41291eb800e0e02120923 (diff)
downloadrails-c01c8967a02537f132d437d5ae15332982119651.tar.gz
rails-c01c8967a02537f132d437d5ae15332982119651.tar.bz2
rails-c01c8967a02537f132d437d5ae15332982119651.zip
Merge commit 'rails/master'
Conflicts: activerecord/lib/active_record/calculations.rb
Diffstat (limited to 'actionpack/lib/abstract_controller/rendering_controller.rb')
-rw-r--r--actionpack/lib/abstract_controller/rendering_controller.rb17
1 files changed, 14 insertions, 3 deletions
diff --git a/actionpack/lib/abstract_controller/rendering_controller.rb b/actionpack/lib/abstract_controller/rendering_controller.rb
index bb7891fbfd..feca1bc4b7 100644
--- a/actionpack/lib/abstract_controller/rendering_controller.rb
+++ b/actionpack/lib/abstract_controller/rendering_controller.rb
@@ -111,12 +111,21 @@ module AbstractController
def _determine_template(options)
name = (options[:_template_name] || action_name).to_s
- options[:_template] ||= view_paths.find(
- name, { :formats => formats }, options[:_prefix], options[:_partial]
- )
+ options[:_template] ||= with_template_cache(name) do
+ view_paths.find(
+ name, { :formats => formats }, options[:_prefix], options[:_partial]
+ )
+ end
+ end
+
+ def with_template_cache(name)
+ yield
end
module ClassMethods
+ def clear_template_caches!
+ end
+
# Append a path to the list of view paths for this controller.
#
# ==== Parameters
@@ -134,6 +143,7 @@ module AbstractController
# the default view path. You may also provide a custom view path
# (see ActionView::ViewPathSet for more information)
def prepend_view_path(path)
+ clear_template_caches!
self.view_paths.unshift(path)
end
@@ -148,6 +158,7 @@ module AbstractController
# paths<ViewPathSet, Object>:: If a ViewPathSet is provided, use that;
# otherwise, process the parameter into a ViewPathSet.
def view_paths=(paths)
+ clear_template_caches!
self._view_paths = paths.is_a?(ActionView::PathSet) ?
paths : ActionView::Base.process_view_paths(paths)
end