This project is archived and is in readonly mode.

Changeset [49e943c4f0ac3459bd53023167aaa08fc8e46733] by Mat Brown

December 2nd, 2009 @ 08:47 PM

Fix instance_eval calls to association proxies

In the current stable, ActiveRecord::Associations::AssociationProxy#method_missing calls yield() if a block is given, causing the block to always be evaluated in its calling context. However, in the case of instance_eval, correct behavior requires that the block be passed directly to the @target, rather than being evaluated inside a different block. Incidentally, this also simplifies the code slightly.

[#3412 state:committed]

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

Committed by Mat Brown

  • M activerecord/lib/active_record/associations/association_proxy.rb
  • M activerecord/test/cases/associations/has_many_associations_test.rb

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>