From ddd85ef9c6a6297a8ff28816d907bbbf2eae5856 Mon Sep 17 00:00:00 2001 From: artemave Date: Fri, 17 Sep 2010 20:39:14 +0000 Subject: #948 template_inheritance --- actionpack/lib/action_view/path_set.rb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'actionpack/lib/action_view/path_set.rb') diff --git a/actionpack/lib/action_view/path_set.rb b/actionpack/lib/action_view/path_set.rb index fa35120a0d..a7078b8232 100644 --- a/actionpack/lib/action_view/path_set.rb +++ b/actionpack/lib/action_view/path_set.rb @@ -11,15 +11,19 @@ module ActionView #:nodoc: end def find(*args) - find_all(*args).first || raise(MissingTemplate.new(self, "#{args[1]}/#{args[0]}", args[3], args[2])) + template = find_all(*args).first + template or raise MissingTemplate.new(self, "{#{args[1].join(',')},}/#{args[0]}", args[3], args[2]) end - def find_all(*args) - each do |resolver| - templates = resolver.find_all(*args) - return templates unless templates.empty? + def find_all(path, prefixes = [], *args) + templates = [] + prefixes.each do |prefix| + each do |resolver| + templates << resolver.find_all(path, prefix, *args) + end + # return templates unless templates.flatten!.empty? XXX this was original behavior; turns this method into find_some, but probably makes it faster end - [] + templates.flatten end def exists?(*args) -- cgit v1.2.3