aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/paths.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-03-08 23:13:24 +0100
committerJosé Valim <jose.valim@gmail.com>2010-03-08 23:25:16 +0100
commit8f082ff4217175f52234f2223658619a9c923afc (patch)
tree10b106df434109c5b5a117a06239a86be8266053 /actionpack/lib/action_view/paths.rb
parent01f0e47663bbbc593af0c36d4cf49124b200e3d8 (diff)
downloadrails-8f082ff4217175f52234f2223658619a9c923afc.tar.gz
rails-8f082ff4217175f52234f2223658619a9c923afc.tar.bz2
rails-8f082ff4217175f52234f2223658619a9c923afc.zip
Clean LookupContext API.
Diffstat (limited to 'actionpack/lib/action_view/paths.rb')
-rw-r--r--actionpack/lib/action_view/paths.rb29
1 files changed, 10 insertions, 19 deletions
diff --git a/actionpack/lib/action_view/paths.rb b/actionpack/lib/action_view/paths.rb
index 82a9f9a13c..35927d09d1 100644
--- a/actionpack/lib/action_view/paths.rb
+++ b/actionpack/lib/action_view/paths.rb
@@ -9,31 +9,22 @@ module ActionView #:nodoc:
METHOD
end
- def find_all(path, details = {}, prefix = nil, partial = false, key=nil)
+ def find(path, prefix = nil, partial = false, details = {}, key = nil)
+ template = find_all(path, prefix, partial, details, key).first
+ raise MissingTemplate.new(self, "#{prefix}/#{path}", details, partial) unless template
+ template
+ end
+
+ def find_all(*args)
each do |resolver|
- templates = resolver.find_all(path, details, prefix, partial, key)
+ templates = resolver.find_all(*args)
return templates unless templates.empty?
end
[]
end
- def find(path, details = {}, prefix = nil, partial = false, key=nil)
- each do |resolver|
- if template = resolver.find(path, details, prefix, partial, key)
- return template
- end
- end
-
- raise ActionView::MissingTemplate.new(self, "#{prefix}/#{path}", details, partial)
- end
-
- def exists?(path, details = {}, prefix = nil, partial = false, key=nil)
- each do |resolver|
- if resolver.find(path, details, prefix, partial, key)
- return true
- end
- end
- false
+ def exists?(*args)
+ find_all(*args).any?
end
protected