aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorSergey Nartimov <just.lest@gmail.com>2011-12-17 19:50:47 +0300
committerSergey Nartimov <just.lest@gmail.com>2011-12-18 10:59:24 +0300
commit109db5a55035781166f295d38a2702ce3cc83858 (patch)
treed59f9b25b5ff4240ce442ffd7d4b35fb0c4513fc /activerecord/test
parent7bde2e2578ea67841409ab5ac951daa58e15474a (diff)
downloadrails-109db5a55035781166f295d38a2702ce3cc83858.tar.gz
rails-109db5a55035781166f295d38a2702ce3cc83858.tar.bz2
rails-109db5a55035781166f295d38a2702ce3cc83858.zip
bypass preloading for ids_reader
when fetching ids for a collection, bypass preloading to avoid the unnecessary performance overhead
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/associations/has_many_through_associations_test.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/has_many_through_associations_test.rb b/activerecord/test/cases/associations/has_many_through_associations_test.rb
index 7a6aba6a6b..c7bc275cf6 100644
--- a/activerecord/test/cases/associations/has_many_through_associations_test.rb
+++ b/activerecord/test/cases/associations/has_many_through_associations_test.rb
@@ -528,6 +528,12 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase
assert_equal [posts(:welcome).id, posts(:authorless).id].sort, people(:michael).post_ids.sort
end
+ def test_get_ids_for_has_many_through_with_conditions_should_not_preload
+ Tagging.create!(:taggable_type => 'Post', :taggable_id => posts(:welcome).id, :tag => tags(:misc))
+ ActiveRecord::Associations::Preloader.expects(:new).never
+ posts(:welcome).misc_tag_ids
+ end
+
def test_get_ids_for_loaded_associations
person = people(:michael)
person.posts(true)