aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2015-12-14 09:59:29 -0700
committerSean Griffin <sean@seantheprogrammer.com>2015-12-14 10:05:53 -0700
commit4ecabed2f65cc899ed2e8858fb1140bca8531ff8 (patch)
treebbe8aa2b93996798622f075d9f329d6ef020de06 /activerecord/test
parent207e2ad9e7be393d871b14da55d23343a22326f6 (diff)
downloadrails-4ecabed2f65cc899ed2e8858fb1140bca8531ff8.tar.gz
rails-4ecabed2f65cc899ed2e8858fb1140bca8531ff8.tar.bz2
rails-4ecabed2f65cc899ed2e8858fb1140bca8531ff8.zip
Revert "Perform a more efficient query in `Relation#any?`"
This reverts commit 6d5b1fdf55611de2a1071c37544933bb588ae88e. `eager_load` and `references` can include hashes, which won't match up with `references` A test case has been added to demonstrate the problem
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/relations_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb
index cd23c1b3e1..7149c7d072 100644
--- a/activerecord/test/cases/relations_test.rb
+++ b/activerecord/test/cases/relations_test.rb
@@ -18,6 +18,7 @@ require 'models/minivan'
require 'models/aircraft'
require "models/possession"
require "models/reader"
+require "models/categorization"
class RelationTest < ActiveRecord::TestCase
fixtures :authors, :topics, :entrants, :developers, :companies, :developers_projects, :accounts, :categories, :categorizations, :posts, :comments,
@@ -918,6 +919,12 @@ class RelationTest < ActiveRecord::TestCase
assert authors.exists?(authors(:david).id)
end
+ def test_any_with_scope_on_hash_includes
+ post = authors(:david).posts.first
+ categories = Categorization.includes(author: :posts).where(posts: { id: post.id })
+ assert categories.exists?
+ end
+
def test_last
authors = Author.all
assert_equal authors(:bob), authors.last