This project is archived and is in readonly mode.

#3412 ✓stale
mat

[Patch] Correctly handle instance_eval in association proxies

Reported by mat | October 22nd, 2009 @ 03:28 PM | in 2.3.10

In the current stable 2.3, 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.

This patch is against the 2-3-stable branch.

Comments and changes to this ticket

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>