aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation
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/lib/active_record/relation
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/lib/active_record/relation')
-rw-r--r--activerecord/lib/active_record/relation/finder_methods.rb9
1 files changed, 2 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb
index b83032e2a0..435cef901b 100644
--- a/activerecord/lib/active_record/relation/finder_methods.rb
+++ b/activerecord/lib/active_record/relation/finder_methods.rb
@@ -280,8 +280,8 @@ module ActiveRecord
return false if !conditions
- relation = apply_join_dependency(self, construct_join_dependency_for_exists)
- return false if ActiveRecord::NullRelation === relation || limit_value == 0
+ relation = apply_join_dependency(self, construct_join_dependency)
+ return false if ActiveRecord::NullRelation === relation
relation = relation.except(:select, :order).select(ONE_AS_ONE).limit(1)
@@ -359,11 +359,6 @@ module ActiveRecord
ActiveRecord::Associations::JoinDependency.new(@klass, including, joins)
end
- def construct_join_dependency_for_exists
- including = (eager_load_values + includes_values) & references_values.map(&:to_sym)
- ActiveRecord::Associations::JoinDependency.new(@klass, including, [])
- end
-
def construct_relation_for_association_calculations
from = arel.froms.first
if Arel::Table === from