From 0127e586d05f3e8342744608315747da488642eb Mon Sep 17 00:00:00 2001 From: Rick Olson Date: Wed, 15 Aug 2007 18:59:37 +0000 Subject: Find layouts even if they're not in the first view_paths directory. Closes #9258 [caio] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7321 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_controller/layout.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 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 860d7b383c..027ae42aeb 100644 --- a/actionpack/lib/action_controller/layout.rb +++ b/actionpack/lib/action_controller/layout.rb @@ -307,12 +307,10 @@ module ActionController #:nodoc: # 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| - File.file?(File.join(path, 'layouts', 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_path ||= File.join(view_paths.first, 'layouts', layout_name) - dirname = File.dirname(template_path) - self.class.send(:layout_directory_exists_cache)[dirname] end end end -- cgit v1.2.3