This project is archived and is in readonly mode.
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
-
David Chelimsky April 9th, 2011 @ 06:51 PM
- Assigned user set to Yehuda Katz (wycats)
-
David Chelimsky April 9th, 2011 @ 06:55 PM
Patch: https://github.com/dchelimsky/rails/commit/e78829dc2ee0d6794c2a657e...
I'm not sure this is the best solution, but it solves the problem. WDYT?
-
David Chelimsky April 9th, 2011 @ 10:02 PM
- Assigned user changed from Yehuda Katz (wycats) to Carl Lerche
-
David Chelimsky April 9th, 2011 @ 10:31 PM
- Assigned user changed from Carl Lerche to Santiago Pastorino
-
David Chelimsky April 9th, 2011 @ 10:50 PM
- Assigned user changed from Santiago Pastorino to José Valim
@josé - wycats suggested you might have some insight on this.
-
David Chelimsky April 9th, 2011 @ 10:53 PM
FYI - the commit that changed this is https://github.com/rails/rails/commit/ddd85ef9.
-
Repository April 13th, 2011 @ 08:46 PM
- State changed from new to committed
(from [a26d407f6380493b39ad84e7f1b29899ead6a1f2]) ActionView::PathSet# accepts String or Array
- Closes #6692
Signed-off-by: José Valim jose.valim@gmail.com
https://github.com/rails/rails/commit/a26d407f6380493b39ad84e7f1b29... -
David Chelimsky April 23rd, 2011 @ 11:20 PM
Here's another commit with better naming for the test case: https://github.com/dchelimsky/rails/commit/220782e4f0ace529f4a48ff2...
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>