From 340a93f5026ffb8e877024c23791e8a345605976 Mon Sep 17 00:00:00 2001 From: Ben Woosley Date: Mon, 28 May 2012 09:52:27 -0700 Subject: Fix that #exists? raises ThrowResult when called with an empty limited reflection. ActiveRecord::FinderMethods#construct_limited_ids_condition will raise ThrowResult if the limited reflection comes back empty. The other callers of #construct_limited_ids_condition handle this exception (more specifically, the callers of construct_relation_for*), but #exists? didn't until now. --- activerecord/lib/active_record/relation/finder_methods.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index 21a99800fe..1de69fce76 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -186,6 +186,8 @@ module ActiveRecord end connection.select_value(relation, "#{name} Exists", relation.bind_values) + rescue ThrowResult + false end protected -- cgit v1.2.3