From cecafc52ee0a4a53c903ddbaba95683261f88e5f Mon Sep 17 00:00:00 2001 From: Yehuda Katz + Carl Lerche Date: Thu, 23 Apr 2009 15:58:38 -0700 Subject: Refactor ActionView::Template ActionView::Template is now completely independent from template storage, which allows different back ends such as the database. ActionView::Template's only responsibility is to take in the template source (passed in from ActionView::Path), compile it, and render it. --- actionpack/lib/action_view/paths.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'actionpack/lib/action_view/paths.rb') diff --git a/actionpack/lib/action_view/paths.rb b/actionpack/lib/action_view/paths.rb index e48088f344..f6d021c92a 100644 --- a/actionpack/lib/action_view/paths.rb +++ b/actionpack/lib/action_view/paths.rb @@ -3,7 +3,7 @@ module ActionView #:nodoc: def self.type_cast(obj) if obj.is_a?(String) cache = !Object.const_defined?(:Rails) || Rails.configuration.cache_classes - Template::FileSystemPath.new(obj, :cache => cache) + Template::FileSystemPathWithFallback.new(obj, :cache => cache) else obj end @@ -34,18 +34,18 @@ module ActionView #:nodoc: end def find_by_parts(path, details = {}, prefix = nil, partial = false) - template_path = path.sub(/^\//, '') + # template_path = path.sub(/^\//, '') + template_path = path each do |load_path| if template = load_path.find_by_parts(template_path, details, prefix, partial) return template end end - - Template.new(path, self) - rescue ActionView::MissingTemplate => e + + # TODO: Have a fallback absolute path? extension = details[:formats] || [] - raise ActionView::MissingTemplate.new(self, "#{prefix}/#{path}.{#{extension.join(",")}}") + raise ActionView::MissingTemplate.new(self, "#{prefix}/#{path} - #{details.inspect} - partial: #{!!partial}") end def find_by_parts?(path, extension = nil, prefix = nil, partial = false) -- cgit v1.2.3