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>
This commit is contained in:
Ian White 2008-10-16 12:02:16 +11:00 committed by Pratik Naik
parent 09c1718198
commit 517bc500ed
2 changed files with 8 additions and 0 deletions

View File

@ -320,6 +320,10 @@ module ActiveRecord
exists?(record)
end
def proxy_respond_to?(method)
super || @reflection.klass.respond_to?(method)
end
protected
def construct_find_options!(options)
end

View File

@ -1080,5 +1080,9 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
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