Permalink
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...
1 parent 09c1718 commit 517bc500ed95a84fd2aadff34fdc14cb7965bc6b @ianwhite ianwhite committed with lifo Oct 16, 2008
@@ -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
@@ -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

0 comments on commit 517bc50

Please sign in to comment.