Doh! When did that happen? Last time I checked it was still waiting to
be folded.
Yes, the core seems to have the same problems. I'll refile the bugs as
soon as Trac is back up (I'm getting a 'duplicate key violates unique
constraint "node_change_rev_key" ' error).
For now, here are the problems I see (this is all assuming you're
using record identification):
For reference, here's how the variables are passed:
in action_view/base.rb, line 308:
render_partial is called with the object, wrapped nil, locals
which means that in partials.rb, line 50:
partial_path is the object, local_assigns is wrapped nil,
deprecated_local_assigns is the locals hash
Here are the problems:
1. when the object is an Array (i.e., we're rendering a collection)
(line 67):
we sensibly name path and collection
we call render_partial_collection with the correct path and
collection, but we use local_assigns.value, which is nil (see above).
Thus locals are not distributed over collections when using
identification.
2. when the object is not an array (i.e., we're rendering a single
object) (line 75):
we call render_partial with the path, local_assigns as the object
(which is a wrapped nil), and deprecated_local_assigns as the locals
hash (which is the actual locals hash)
Thus the object is not properly forwarded to
render_partial(string ...).
Also, for the collection, the test for a trivial collection is
inconsistent with the assumptions made: if we test for any?, then we
should use the first non-nil value, instead of just the first.
Here's a suggested patch:
http://pastie.caboo.se/63352
Nick