From dd34691b8d04a41e7d2b34df96bfe849057dd093 Mon Sep 17 00:00:00 2001 From: Yehuda Katz + Carl Lerche Date: Wed, 2 Sep 2009 15:53:38 -0700 Subject: Extract finding the template in AC to it's own method --- actionpack/lib/abstract_controller/rendering_controller.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'actionpack/lib/abstract_controller/rendering_controller.rb') diff --git a/actionpack/lib/abstract_controller/rendering_controller.rb b/actionpack/lib/abstract_controller/rendering_controller.rb index feca1bc4b7..c23b1a9aa7 100644 --- a/actionpack/lib/abstract_controller/rendering_controller.rb +++ b/actionpack/lib/abstract_controller/rendering_controller.rb @@ -112,11 +112,13 @@ module AbstractController name = (options[:_template_name] || action_name).to_s options[:_template] ||= with_template_cache(name) do - view_paths.find( - name, { :formats => formats }, options[:_prefix], options[:_partial] - ) + find_template(name, { :formats => formats }, options) end end + + def find_template(name, details, options) + view_paths.find(name, details, options[:_prefix], options[:_partial]) + end def with_template_cache(name) yield -- cgit v1.2.3 From e3744166ec0b98b76175ee70bda8051fb05690e7 Mon Sep 17 00:00:00 2001 From: Yehuda Katz + Carl Lerche Date: Thu, 3 Sep 2009 12:41:28 -0700 Subject: Refactor ActionController to use find_template and template_exists? --- actionpack/lib/abstract_controller/rendering_controller.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'actionpack/lib/abstract_controller/rendering_controller.rb') diff --git a/actionpack/lib/abstract_controller/rendering_controller.rb b/actionpack/lib/abstract_controller/rendering_controller.rb index c23b1a9aa7..bbf941aa32 100644 --- a/actionpack/lib/abstract_controller/rendering_controller.rb +++ b/actionpack/lib/abstract_controller/rendering_controller.rb @@ -119,7 +119,11 @@ module AbstractController def find_template(name, details, options) view_paths.find(name, details, options[:_prefix], options[:_partial]) end - + + def template_exists?(name, details, options) + view_paths.exists?(name, details, options[:_prefix], options[:_partial]) + end + def with_template_cache(name) yield end -- cgit v1.2.3