diff options
author | Benedikt Deicke <benedikt@synatic.net> | 2012-04-03 21:13:24 +0200 |
---|---|---|
committer | Benedikt Deicke <benedikt@synatic.net> | 2012-04-03 21:13:24 +0200 |
commit | 402576b044ce1cb06c3e48061f62542d0908fa17 (patch) | |
tree | bddb57fc6c9619df94bc2479d02c7f25658d380d /activerecord/test/cases/associations/eager_test.rb | |
parent | 68677ffb8298105eb9d3efa26d928dd88cc5e006 (diff) | |
download | rails-402576b044ce1cb06c3e48061f62542d0908fa17.tar.gz rails-402576b044ce1cb06c3e48061f62542d0908fa17.tar.bz2 rails-402576b044ce1cb06c3e48061f62542d0908fa17.zip |
Adds test to check that circular preloading does not modify Model.unscoped (as described in #5667)
Diffstat (limited to 'activerecord/test/cases/associations/eager_test.rb')
-rw-r--r-- | activerecord/test/cases/associations/eager_test.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb index efdb7cbb36..f7f44208b3 100644 --- a/activerecord/test/cases/associations/eager_test.rb +++ b/activerecord/test/cases/associations/eager_test.rb @@ -1174,6 +1174,12 @@ class EagerAssociationTest < ActiveRecord::TestCase assert_equal Comment.find(1), Comment.preload(:post => :comments).scoping { Comment.find(1) } end + test "circular preload does not modify unscoped" do + expected = FirstPost.unscoped.find(2) + FirstPost.preload(:comments => :first_post).find(1) + assert_equal expected, FirstPost.unscoped.find(2) + end + test "preload ignores the scoping" do assert_equal( Comment.find(1).post, |