From 61c90a4ad6eab3623002353ed5867e2f05cb6809 Mon Sep 17 00:00:00 2001 From: Michael Koziarski Date: Mon, 21 Jan 2008 20:45:04 +0000 Subject: Reapply the TemplateFinder first applied in [8669] then reverted in [8676]. Closes #10800 [lifofifo] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8683 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_controller/layout.rb | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'actionpack/lib/action_controller/layout.rb') diff --git a/actionpack/lib/action_controller/layout.rb b/actionpack/lib/action_controller/layout.rb index a81efc2693..0fbbfa8b05 100644 --- a/actionpack/lib/action_controller/layout.rb +++ b/actionpack/lib/action_controller/layout.rb @@ -208,12 +208,6 @@ module ActionController #:nodoc: conditions.inject({}) {|hash, (key, value)| hash.merge(key => [value].flatten.map {|action| action.to_s})} end - def layout_directory_exists_cache - @@layout_directory_exists_cache ||= Hash.new do |h, dirname| - h[dirname] = File.directory? dirname - end - end - def default_layout_with_format(format, layout) list = layout_list if list.grep(%r{layouts/#{layout}\.#{format}(\.[a-z][0-9a-z]*)+$}).empty? @@ -313,13 +307,8 @@ module ActionController #:nodoc: end end - # Does a layout directory for this class exist? - # we cache this info in a class level hash def layout_directory?(layout_name) - view_paths.find do |path| - next unless template_path = Dir[File.join(path, 'layouts', layout_name) + ".*"].first - self.class.send!(:layout_directory_exists_cache)[File.dirname(template_path)] - end + @template.finder.find_template_extension_from_handler(File.join('layouts', layout_name)) end end end -- cgit v1.2.3