mirror of https://github.com/rails/rails
Revert "Optimize `ActiveRecord::Relation#exists?` with no conditions for loaded relations"
This commit is contained in:
parent
0378b056de
commit
3b247873e2
|
@ -365,7 +365,6 @@ module ActiveRecord
|
|||
end
|
||||
|
||||
return false if !conditions || limit_value == 0
|
||||
return !records.empty? if conditions == :none && loaded?
|
||||
|
||||
if eager_loading?
|
||||
relation = apply_join_dependency(eager_loading: false)
|
||||
|
|
|
@ -285,19 +285,6 @@ class FinderTest < ActiveRecord::TestCase
|
|||
assert_equal true, Topic.exists?
|
||||
end
|
||||
|
||||
def test_exists_with_loaded_relation
|
||||
topics = Topic.all.load
|
||||
assert_no_queries do
|
||||
assert_equal true, topics.exists?
|
||||
end
|
||||
|
||||
Topic.delete_all
|
||||
topics = Topic.all.load
|
||||
assert_no_queries do
|
||||
assert_equal false, topics.exists?
|
||||
end
|
||||
end
|
||||
|
||||
def test_exists_returns_false_with_false_arg
|
||||
assert_equal false, Topic.exists?(false)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue