Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow class methods to be sent (via #send) to association proxy (fix …

…for bug introduced by 691aa20) [#1083]

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
  • Loading branch information...
commit 517bc500ed95a84fd2aadff34fdc14cb7965bc6b 1 parent 09c1718
@ianwhite ianwhite authored lifo committed
View
4 activerecord/lib/active_record/associations/association_collection.rb
@@ -320,6 +320,10 @@ def include?(record)
exists?(record)
end
+ def proxy_respond_to?(method)
+ super || @reflection.klass.respond_to?(method)
+ end
+
protected
def construct_find_options!(options)
end
View
4 activerecord/test/cases/associations/has_many_associations_test.rb
@@ -1080,5 +1080,9 @@ def test_association_proxy_transaction_method_starts_transaction_in_association_
end
end
+ def test_sending_new_to_association_proxy_should_have_same_effect_as_calling_new
+ clients_assoc = companies(:first_firm).clients
+ assert_equal clients_assoc.new.attributes, clients_assoc.send(:new).attributes
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.