diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-06-15 07:33:20 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-06-15 10:56:56 +0900 |
commit | 9276ebc773d3287a9fa8d1c6ce9e3a14ceeb8add (patch) | |
tree | 55e883cadef2d0c09c60a77a81ecedfc90e2d753 /activerecord/lib/active_record/relation | |
parent | f340490b98ac9f13f004b5db8863cb3ff6fb71f9 (diff) | |
download | rails-9276ebc773d3287a9fa8d1c6ce9e3a14ceeb8add.tar.gz rails-9276ebc773d3287a9fa8d1c6ce9e3a14ceeb8add.tar.bz2 rails-9276ebc773d3287a9fa8d1c6ce9e3a14ceeb8add.zip |
Fix `Relation#exists?` queries with query cache
If a connection adapter overrides `select_*` methods, query caching will
doesn't work. This patch changes `select_value` to `select_one` in
`Relation#exists?` to ensure query caching.
Fixes #29449.
Diffstat (limited to 'activerecord/lib/active_record/relation')
-rw-r--r-- | activerecord/lib/active_record/relation/finder_methods.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index 1d661fa8ed..0a339f8756 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -316,7 +316,7 @@ module ActiveRecord relation = construct_relation_for_exists(relation, conditions) - connection.select_value(relation, "#{name} Exists", relation.bound_attributes) ? true : false + connection.select_one(relation.arel, "#{name} Exists", relation.bound_attributes) ? true : false rescue ::RangeError false end |