Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

PathSet and Resolver APIs differ in rails-3.0.6 and master

#6692

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.

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

State: committed
Milestone: none
Assigned to: José Valim José Valim
Importance: none

Activity

  1. David Chelimsky
    David Chelimsky
    • Assigned user set to Yehuda Katz (wycats)

    April 9th, 2011 @ 06:51 PM

  2. David Chelimsky
    David Chelimsky

    Patch: https://github.com/dchelimsky/rails/commit/e78829dc2ee0d6794c2a657e...

    I'm not sure this is the best solution, but it solves the problem. WDYT?

    April 9th, 2011 @ 06:55 PM

  3. David Chelimsky
    David Chelimsky
    • Assigned user changed from Yehuda Katz (wycats) to Carl Lerche

    April 9th, 2011 @ 10:02 PM

  4. David Chelimsky
    David Chelimsky
    • Assigned user changed from Carl Lerche to Santiago Pastorino

    April 9th, 2011 @ 10:31 PM

  5. David Chelimsky
    David Chelimsky
    • Assigned user changed from Santiago Pastorino to José Valim

    @josé - wycats suggested you might have some insight on this.

    April 9th, 2011 @ 10:50 PM

  6. David Chelimsky
  7. Repository
  8. David Chelimsky