aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations_test.rb
diff options
context:
space:
mode:
authorWill <will@makisu.local>2009-12-16 10:49:06 -0600
committerJoshua Peek <josh@joshpeek.com>2009-12-16 10:49:53 -0600
commitbf6af5f71917b5615edb5905729b22772133eea4 (patch)
tree5a7a3d79c7f9288ac52151acbef7be45e1171f7a /activerecord/test/cases/associations_test.rb
parent1b27f5c4f72384081083fa025b6b10e5ab02ae5e (diff)
downloadrails-bf6af5f71917b5615edb5905729b22772133eea4.tar.gz
rails-bf6af5f71917b5615edb5905729b22772133eea4.tar.bz2
rails-bf6af5f71917b5615edb5905729b22772133eea4.zip
When passing force_reload = true to an association, don't use the query cache [#1827 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
Diffstat (limited to 'activerecord/test/cases/associations_test.rb')
-rw-r--r--activerecord/test/cases/associations_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations_test.rb b/activerecord/test/cases/associations_test.rb
index e429c1d157..9bc34bd750 100644
--- a/activerecord/test/cases/associations_test.rb
+++ b/activerecord/test/cases/associations_test.rb
@@ -64,6 +64,16 @@ class AssociationsTest < ActiveRecord::TestCase
assert !firm.clients(true).empty?, "New firm should have reloaded client objects"
assert_equal 1, firm.clients(true).size, "New firm should have reloaded clients count"
end
+
+ def test_force_reload_is_uncached
+ firm = Firm.create!("name" => "A New Firm, Inc")
+ client = Client.create!("name" => "TheClient.com", :firm => firm)
+ ActiveRecord::Base.cache do
+ firm.clients.each {}
+ assert_queries(0) { assert_not_nil firm.clients.each {} }
+ assert_queries(1) { assert_not_nil firm.clients(true).each {} }
+ end
+ end
end