From 9d569585a20ddd9ddb3602921f2ccffc208998d8 Mon Sep 17 00:00:00 2001 From: Ben Woosley Date: Sat, 20 Sep 2014 09:03:03 -0700 Subject: Isolate access to @associations_cache and @aggregations cache to the Associations and Aggregations modules, respectively. This includes replacing the `association_cache` accessor with a more limited `association_cached?` accessor and making `clear_association_cache` and `clear_aggregation_cache` private. --- activerecord/test/cases/associations/belongs_to_associations_test.rb | 4 ++-- activerecord/test/cases/associations_test.rb | 4 ++-- activerecord/test/cases/inheritance_test.rb | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'activerecord/test') diff --git a/activerecord/test/cases/associations/belongs_to_associations_test.rb b/activerecord/test/cases/associations/belongs_to_associations_test.rb index 25555bd75c..e3ddcd98c0 100644 --- a/activerecord/test/cases/associations/belongs_to_associations_test.rb +++ b/activerecord/test/cases/associations/belongs_to_associations_test.rb @@ -92,14 +92,14 @@ class BelongsToAssociationsTest < ActiveRecord::TestCase Firm.create("name" => "Apple") Client.create("name" => "Citibank", :firm_name => "Apple") citibank_result = Client.all.merge!(:where => {:name => "Citibank"}, :includes => :firm_with_primary_key).first - assert citibank_result.association_cache.key?(:firm_with_primary_key) + assert citibank_result.association_cached?(:firm_with_primary_key) end def test_eager_loading_with_primary_key_as_symbol Firm.create("name" => "Apple") Client.create("name" => "Citibank", :firm_name => "Apple") citibank_result = Client.all.merge!(:where => {:name => "Citibank"}, :includes => :firm_with_primary_key_symbols).first - assert citibank_result.association_cache.key?(:firm_with_primary_key_symbols) + assert citibank_result.association_cached?(:firm_with_primary_key_symbols) end def test_creating_the_belonging_object diff --git a/activerecord/test/cases/associations_test.rb b/activerecord/test/cases/associations_test.rb index 9b0cf4c18f..c40bcd068c 100644 --- a/activerecord/test/cases/associations_test.rb +++ b/activerecord/test/cases/associations_test.rb @@ -46,7 +46,7 @@ class AssociationsTest < ActiveRecord::TestCase firm = Firm.find(1) assert_kind_of Firm, firm - firm.clear_association_cache + firm.send(:clear_association_cache) assert_equal Firm.find(1).clients.collect{ |x| x.name }.sort, firm.clients.collect{ |x| x.name }.sort end @@ -60,7 +60,7 @@ class AssociationsTest < ActiveRecord::TestCase firm.clients << clients assert_equal clients.map(&:name).to_set, firm.clients.map(&:name).to_set - firm.clear_association_cache + firm.send(:clear_association_cache) assert_equal clients.map(&:name).to_set, firm.clients.map(&:name).to_set end diff --git a/activerecord/test/cases/inheritance_test.rb b/activerecord/test/cases/inheritance_test.rb index 792950d24d..969e71898a 100644 --- a/activerecord/test/cases/inheritance_test.rb +++ b/activerecord/test/cases/inheritance_test.rb @@ -294,12 +294,12 @@ class InheritanceTest < ActiveRecord::TestCase def test_eager_load_belongs_to_something_inherited account = Account.all.merge!(:includes => :firm).find(1) - assert account.association_cache.key?(:firm), "nil proves eager load failed" + assert account.association_cached?(:firm), "nil proves eager load failed" end def test_alt_eager_loading cabbage = RedCabbage.all.merge!(:includes => :seller).find(4) - assert cabbage.association_cache.key?(:seller), "nil proves eager load failed" + assert cabbage.association_cached?(:seller), "nil proves eager load failed" end def test_eager_load_belongs_to_primary_key_quoting -- cgit v1.2.3