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.

revise #to_a in associations

#4165

Currently #to_a is removed from AssociationProxy.

If you do Array(post.author) method_missing sends #to_a to the @target, which invokes Kernel#to_a directly. That issues a warning "warning: default to_a' will be obsolete".

This patch keeps #to_a in AssociationProxy so that Array() works normally, and delegates #to_a to the @target by hand in association collections.

Reported by Xavier Noria · March 12th, 2010 @ 07:32 PM

State: committed
Milestone: none
Assigned to: Jeremy Kemper Jeremy Kemper
Importance: none

Activity

  1. Repository
    Repository
    • State changed from new to committed

    (from [fe43bbd8c71fabb4b612808c42461b2ba9655318]) keep AssociationProxy#to_a to avoid warning in Array(post.author), and delegate it to @target in association collections

    [#4165 state:committed]

    Signed-off-by: Jeremy Kemper jeremy@bitsweat.net
    http://github.com/rails/rails/commit/fe43bbd8c71fabb4b612808c42461b...

    March 12th, 2010 @ 07:54 PM

  2. Josh Sharpe
    Josh Sharpe
    • Assigned user set to Jeremy Kemper

    This bug actually exists on on the 2-3 branch as well and just bit us. Should this also be applied there?

    May 27th, 2010 @ 09:54 PM