aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorSimon Woker <github@simonwoker.de>2014-04-11 17:54:03 +0000
committerSimon Woker <github@simonwoker.de>2014-04-11 17:54:03 +0000
commit70fffaccfc9761498cb50537d8b29c2e5d0585d1 (patch)
tree3f897d59dffd1bfd99c8b97788264f55027a5e97 /activerecord/test/cases
parentafd4d8205e6a3264c30a29e4a2de0f1e71ef0717 (diff)
downloadrails-70fffaccfc9761498cb50537d8b29c2e5d0585d1.tar.gz
rails-70fffaccfc9761498cb50537d8b29c2e5d0585d1.tar.bz2
rails-70fffaccfc9761498cb50537d8b29c2e5d0585d1.zip
fix exception on polymorphic associations with predicates
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/associations/eager_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb
index 8c9797861c..3133f60bcf 100644
--- a/activerecord/test/cases/associations/eager_test.rb
+++ b/activerecord/test/cases/associations/eager_test.rb
@@ -1197,7 +1197,15 @@ class EagerAssociationTest < ActiveRecord::TestCase
author = Author.includes(:posts).references(:posts).reorder(:name).find_by('posts.title IS NOT NULL')
assert_equal authors(:bob), author
end
+
+ test "preloading with a polymorphic association and using the existential predicate but also using a select" do
+ assert_equal authors(:david), authors(:david).essays.includes(:writer).first.writer
+ assert_nothing_raised do
+ authors(:david).essays.includes(:writer).select(:name).any?
+ end
+ end
+
test "preloading with a polymorphic association and using the existential predicate" do
assert_equal authors(:david), authors(:david).essays.includes(:writer).first.writer