1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Also allow prefixes as third argument to lookup context.

This commit is contained in:
José Valim 2011-05-04 09:07:11 +02:00
parent 4758d37044
commit c9fa3f03fe
3 changed files with 4 additions and 6 deletions

View file

@ -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

View file

@ -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|

View file

@ -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)