Patch for correct instance_eval behavior for AssociationProxy

View: New views
1 Messages — Rating Filter:   Alert me  

Patch for correct instance_eval behavior for AssociationProxy

by outoftime-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi all,

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.

Much appreciated if y'all would check it out! It's a very small patch
and includes test cases.

https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/3412-patch-correctly-handle-instance_eval-in-association-proxies#ticket-3412-2

Thanks,
Mat

--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-core@...
To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---