diff options
author | Emilio Tagua <miloops@gmail.com> | 2009-08-17 19:46:06 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2009-08-17 19:46:06 -0300 |
commit | c01c8967a02537f132d437d5ae15332982119651 (patch) | |
tree | 76ed47f6bffd5fe1aa11c65cd32b222d881f43aa /actionpack/lib/abstract_controller/rendering_controller.rb | |
parent | 770fca10fba68fa14308f33e923493e6f63bfa35 (diff) | |
parent | ccf28d2499d1b4e2aba41291eb800e0e02120923 (diff) | |
download | rails-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.rb | 17 |
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 |