diff options
Diffstat (limited to 'actionpack/lib')
4 files changed, 11 insertions, 15 deletions
diff --git a/actionpack/lib/action_view/lookup_context.rb b/actionpack/lib/action_view/lookup_context.rb index 0d7f15e564..1365048724 100644 --- a/actionpack/lib/action_view/lookup_context.rb +++ b/actionpack/lib/action_view/lookup_context.rb @@ -119,13 +119,14 @@ module ActionView name = name.to_s.gsub(handlers_regexp, '') parts = name.split('/') name = parts.pop - prx = if prefixes.blank? - [parts.compact.join('/')] - else - prefixes.map {|prefix| [prefix, *parts].compact.join('/') } - end - return name, prx + prefixes = if prefixes.blank? + [parts.join('/')] + else + prefixes.map { |prefix| [prefix, *parts].compact.join('/') } + end + + return name, prefixes end def default_handlers #:nodoc: diff --git a/actionpack/lib/action_view/path_set.rb b/actionpack/lib/action_view/path_set.rb index 2a54b12f78..2f662b0739 100644 --- a/actionpack/lib/action_view/path_set.rb +++ b/actionpack/lib/action_view/path_set.rb @@ -21,26 +21,21 @@ module ActionView #:nodoc: def find_all(path, prefixes = [], *args) prefixes.each do |prefix| templates = [] - each do |resolver| templates.concat resolver.find_all(path, prefix, *args) end - return templates unless templates.empty? end - [] end def find_first(path, prefixes = [], *args) prefixes.each do |prefix| each do |resolver| - if template = resolver.find_all(path, prefix, *args).first - return template - end + template = resolver.find_all(path, prefix, *args).first + return template if template end end - nil end diff --git a/actionpack/lib/action_view/renderer/partial_renderer.rb b/actionpack/lib/action_view/renderer/partial_renderer.rb index f36b0602b1..3fdea23a4a 100644 --- a/actionpack/lib/action_view/renderer/partial_renderer.rb +++ b/actionpack/lib/action_view/renderer/partial_renderer.rb @@ -111,7 +111,7 @@ module ActionView end def find_template(path=@path, locals=@locals.keys) - prefixes = path.include?(?/) ? [] : @view.controller._prefixes + prefixes = path.include?(?/) ? [] : @view.controller_prefixes @lookup_context.find_template(path, prefixes, true, locals) end diff --git a/actionpack/lib/action_view/renderer/template_renderer.rb b/actionpack/lib/action_view/renderer/template_renderer.rb index 938bb2a3f3..9ae1636131 100644 --- a/actionpack/lib/action_view/renderer/template_renderer.rb +++ b/actionpack/lib/action_view/renderer/template_renderer.rb @@ -43,7 +43,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], [], false, keys) } + with_fallbacks { find_template(options[:file], options[:prefixes], false, keys) } elsif options.key?(:inline) handler = Template.handler_for_extension(options[:type] || "erb") Template.new(options[:inline], "inline template", handler, :locals => keys) |