From 7aeca5066ada5077cb6aaf7fb331a146afc76cfd Mon Sep 17 00:00:00 2001 From: Kassio Borges Date: Mon, 18 Aug 2014 18:18:34 -0300 Subject: Fixes the `Relation#exists?` to work with polymorphic associations. Fixes #15821. --- activerecord/lib/active_record/relation/finder_methods.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib') 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 -- cgit v1.2.3