diff options
Diffstat (limited to 'actionpack/lib/action_view/paths.rb')
-rw-r--r-- | actionpack/lib/action_view/paths.rb | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/actionpack/lib/action_view/paths.rb b/actionpack/lib/action_view/paths.rb index 1d0279889c..95c56faf9c 100644 --- a/actionpack/lib/action_view/paths.rb +++ b/actionpack/lib/action_view/paths.rb @@ -2,8 +2,8 @@ module ActionView #:nodoc: class PathSet < Array #: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) + cache = !defined?(Rails) || !Rails.respond_to?(:configuration) || Rails.configuration.cache_classes + Template::FileSystemPathWithFallback.new(obj, :cache => cache) else obj end @@ -33,19 +33,19 @@ module ActionView #:nodoc: super(*objs.map { |obj| self.class.type_cast(obj) }) end - def find_by_parts(path, extension = nil, prefix = nil, partial = false) - template_path = path.sub(/^\//, '') + def find_by_parts(path, details = {}, prefix = nil, partial = false) + # template_path = path.sub(/^\//, '') + template_path = path each do |load_path| - if template = load_path.find_by_parts(template_path, extension, prefix, partial) + if template = load_path.find_by_parts(template_path, details, prefix, partial) return template end end - - Template.new(path, self) - rescue ActionView::MissingTemplate => e - extension ||= [] - raise ActionView::MissingTemplate.new(self, "#{prefix}/#{path}.{#{extension.join(",")}}") + + # TODO: Have a fallback absolute path? + extension = details[:formats] || [] + raise ActionView::MissingTemplate.new(self, "#{prefix}/#{path} - #{details.inspect} - partial: #{!!partial}") end def find_by_parts?(path, extension = nil, prefix = nil, partial = false) |