diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2008-10-21 14:29:41 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-10-21 14:29:41 +0100 |
commit | fa09de351c8045c7e7a0f268188ccf80c827b079 (patch) | |
tree | 529922eaddfb5575d026f214bb84b9cd5a022d23 /activerecord | |
parent | d2f3bddaebc0d52fd4df1392c87c84333612c531 (diff) | |
parent | a5cdb7a813515fa0cbee23101d2f911b4017ed90 (diff) | |
download | rails-fa09de351c8045c7e7a0f268188ccf80c827b079.tar.gz rails-fa09de351c8045c7e7a0f268188ccf80c827b079.tar.bz2 rails-fa09de351c8045c7e7a0f268188ccf80c827b079.zip |
Merge commit 'mainstream/master'
Diffstat (limited to 'activerecord')
3 files changed, 18 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/associations/association_collection.rb b/activerecord/lib/active_record/associations/association_collection.rb index da1a7887ce..0ff91fbdf8 100644 --- a/activerecord/lib/active_record/associations/association_collection.rb +++ b/activerecord/lib/active_record/associations/association_collection.rb @@ -326,8 +326,8 @@ module ActiveRecord exists?(record) end - def proxy_respond_to?(method) - super || @reflection.klass.respond_to?(method) + def proxy_respond_to?(method, include_private = false) + super || @reflection.klass.respond_to?(method, include_private) end protected diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb index dada2d1603..8d97b30c74 100644 --- a/activerecord/test/cases/associations/has_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_associations_test.rb @@ -1081,8 +1081,14 @@ class HasManyAssociationsTest < ActiveRecord::TestCase 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 + client_association = companies(:first_firm).clients + assert_equal client_association.new.attributes, client_association.send(:new).attributes + end + + def test_respond_to_private_class_methods + client_association = companies(:first_firm).clients + assert !client_association.respond_to?(:private_method) + assert client_association.respond_to?(:private_method, true) end end diff --git a/activerecord/test/models/company.rb b/activerecord/test/models/company.rb index 62d20861f3..0e3fafa37c 100644 --- a/activerecord/test/models/company.rb +++ b/activerecord/test/models/company.rb @@ -112,6 +112,14 @@ class Client < Company def rating? query_attribute :rating end + + class << self + private + + def private_method + "darkness" + end + end end |