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

On May 19, 5:10 pm, DHH <[EMAIL PROTECTED]> wrote:
> > It'd be nice to see these get checked in (or at least reviewed) if
> > they are actual bugs.
>
> Hi Nick,
>
> Simply Helpful has been folded into core. Could you check if these
> problems are still present on edge? If so, please do post again here
> and I'll apply.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to