From c9fa3f03fee1b3a191fa64ec4e31b1f84b66e9d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 4 May 2011 09:07:11 +0200 Subject: Also allow prefixes as third argument to lookup context. --- actionpack/lib/abstract_controller/view_paths.rb | 4 +--- actionpack/lib/action_view/lookup_context.rb | 4 ++-- actionpack/lib/action_view/renderer/template_renderer.rb | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/abstract_controller/view_paths.rb b/actionpack/lib/abstract_controller/view_paths.rb index 4fdca2cc5c..a777cf866d 100644 --- a/actionpack/lib/abstract_controller/view_paths.rb +++ b/actionpack/lib/abstract_controller/view_paths.rb @@ -16,9 +16,7 @@ module AbstractController # information. def lookup_context @lookup_context ||= - ActionView::LookupContext.new(self.class._view_paths, details_for_lookup).tap do |ctx| - ctx.prefixes = _prefixes - end + ActionView::LookupContext.new(self.class._view_paths, details_for_lookup, _prefixes) end def details_for_lookup diff --git a/actionpack/lib/action_view/lookup_context.rb b/actionpack/lib/action_view/lookup_context.rb index 797a55b2b6..06975ffa2f 100644 --- a/actionpack/lib/action_view/lookup_context.rb +++ b/actionpack/lib/action_view/lookup_context.rb @@ -60,11 +60,11 @@ module ActionView end end - def initialize(view_paths, details = {}) + def initialize(view_paths, details = {}, prefixes = []) @details, @details_key = { :handlers => default_handlers }, nil @frozen_formats, @skip_default_locale = false, false @cache = true - @prefixes = [] + @prefixes = prefixes self.view_paths = view_paths self.registered_detail_setters.each do |key, setter| diff --git a/actionpack/lib/action_view/renderer/template_renderer.rb b/actionpack/lib/action_view/renderer/template_renderer.rb index 6c55a865a1..a09cef8fef 100644 --- a/actionpack/lib/action_view/renderer/template_renderer.rb +++ b/actionpack/lib/action_view/renderer/template_renderer.rb @@ -20,7 +20,7 @@ module ActionView if options.key?(:text) Template::Text.new(options[:text], formats.try(:first)) elsif options.key?(:file) - with_fallbacks { find_template(options[:file], options[:prefixes], false, keys) } + with_fallbacks { find_template(options[:file], nil, false, keys) } elsif options.key?(:inline) handler = Template.handler_for_extension(options[:type] || "erb") Template.new(options[:inline], "inline template", handler, :locals => keys) -- cgit v1.2.3