From 8f50bbee31ca4b2cc2ac9b9889c421f6a38d97f4 Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Fri, 11 May 2012 18:19:39 +0100 Subject: set_owner_attributes is covered by the scoping --- activerecord/lib/active_record/associations/collection_proxy.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/associations/collection_proxy.rb b/activerecord/lib/active_record/associations/collection_proxy.rb index 47ed9f58d8..66815d83bc 100644 --- a/activerecord/lib/active_record/associations/collection_proxy.rb +++ b/activerecord/lib/active_record/associations/collection_proxy.rb @@ -84,10 +84,9 @@ module ActiveRecord def method_missing(method, *args, &block) match = DynamicMatchers::Method.match(self, method) if match && match.is_a?(DynamicMatchers::Instantiator) - super do |r| - proxy_association.send :set_owner_attributes, r - proxy_association.send :add_to_target, r - yield(r) if block_given? + super do |record| + proxy_association.add_to_target(record) + yield record if block_given? end elsif target.respond_to?(method) || (!proxy_association.klass.respond_to?(method) && Class.respond_to?(method)) -- cgit v1.2.3