diff options
author | Rick Olson <technoweenie@gmail.com> | 2007-08-15 18:59:37 +0000 |
---|---|---|
committer | Rick Olson <technoweenie@gmail.com> | 2007-08-15 18:59:37 +0000 |
commit | 0127e586d05f3e8342744608315747da488642eb (patch) | |
tree | 3f3658068188de642cbaeb648033d74996e26f60 /actionpack/lib/action_controller | |
parent | d0c83c435459b3fff53075a84411f39707f31325 (diff) | |
download | rails-0127e586d05f3e8342744608315747da488642eb.tar.gz rails-0127e586d05f3e8342744608315747da488642eb.tar.bz2 rails-0127e586d05f3e8342744608315747da488642eb.zip |
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
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/layout.rb | 8 |
1 files changed, 3 insertions, 5 deletions
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 |