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:
parent
09c1718198
commit
517bc500ed
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue