From 96bd936b64ae06d4c38e8de862521e22d7c809b9 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 21 Sep 2010 13:53:21 -0700 Subject: providing arel with column information when possible [#5392 state:resolved] --- activerecord/test/cases/associations/join_model_test.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'activerecord/test/cases/associations') diff --git a/activerecord/test/cases/associations/join_model_test.rb b/activerecord/test/cases/associations/join_model_test.rb index b83966e91c..f131dc01f6 100644 --- a/activerecord/test/cases/associations/join_model_test.rb +++ b/activerecord/test/cases/associations/join_model_test.rb @@ -44,6 +44,16 @@ class AssociationsJoinModelTest < ActiveRecord::TestCase assert !authors(:mary).unique_categorized_posts.loaded? end + def test_column_caching + # pre-heat our cache + Post.arel_table.columns + Comment.columns + + Post.connection.column_calls = 0 + 2.times { Post.joins(:comments).to_a } + assert_equal 0, Post.connection.column_calls + end + def test_has_many_uniq_through_find assert_equal 1, authors(:mary).unique_categorized_posts.find(:all).size end -- cgit v1.2.3