This project is archived and is in readonly mode.

#6692 ✓committed
David Chelimsky

PathSet and Resolver APIs differ in rails-3.0.6 and master

Reported by David Chelimsky | April 9th, 2011 @ 06:50 PM

I've got a custom resolver that customizes templates coming through find_all:

class CustomResolver < ::ActionView::Resolver
  attr_reader :path_set

  def initialize(path_set)
    @path_set = path_set
  end

  def find_all(*args)
    path_set.find_all(*args).collect do |template|
      # do stuff to the template
    end
  end
end

which then gets assigned like this:

view_paths = ::ActionView::PathSet.new.push(CustomResolver.new(view_paths))

This works fine with rails-3.0.6, but I started seeing this error on the rails master branch:

Could not render layout: undefined method `each' for "layouts":String

I've tracked this down to a change in the signature of ActionView::Resolver#find_all.

In rails-3.0.6, the signature for ActionView::PathSet#find_all is this:

def find_all(*args)

and the signature for ActionView::Resolver#find_all is this:

def find_all(name, prefix=nil, partial=false, details={}, key=nil)

In rails-master, the signature for ActionView::Resolver#find_all has changed to this:

def find_all(path, prefixes = [], *args)

So now, in Rails master, PathSet calls find_all on the custom resolver with an String prefix, but when the custom resolver calls find_all on the path_set with that prefix, it's expecting an Array.

Assuming that the intent is to support custom resolvers like this, I think that ActionView::Resolver#find_all should accept either a String or an Array for the 2nd arg.

Patch coming shortly.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Referenced by

Pages