aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorKassio Borges <kassioborgesm@gmail.com>2014-08-18 18:18:34 -0300
committerKassio Borges <kassioborgesm@gmail.com>2014-08-18 18:20:40 -0300
commit7aeca5066ada5077cb6aaf7fb331a146afc76cfd (patch)
treec5a2588e1f1659e441a2e8bce442e2aed5e36eb4 /activerecord/lib
parent986dee5ca1db38ddb2e5394a0cc88831b175e018 (diff)
downloadrails-7aeca5066ada5077cb6aaf7fb331a146afc76cfd.tar.gz
rails-7aeca5066ada5077cb6aaf7fb331a146afc76cfd.tar.bz2
rails-7aeca5066ada5077cb6aaf7fb331a146afc76cfd.zip
Fixes the `Relation#exists?` to work with polymorphic associations.
Fixes #15821.
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/relation/finder_methods.rb2
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 0c9c761f97..a7899da3a8 100644
--- a/activerecord/lib/active_record/relation/finder_methods.rb
+++ b/activerecord/lib/active_record/relation/finder_methods.rb
@@ -304,7 +304,7 @@ module ActiveRecord
end
end
- connection.select_value(relation, "#{name} Exists", relation.bind_values) ? true : false
+ connection.select_value(relation, "#{name} Exists", relation.arel.bind_values + relation.bind_values) ? true : false
end
# This method is called whenever no records are found with either a single