mirror of
https://github.com/github/rails.git
synced 2026-01-26 06:48:59 -05:00
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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user