From 62f098dddf55a36e15c94a60b29c3c280b219cce Mon Sep 17 00:00:00 2001 From: Andrew White Date: Thu, 10 May 2012 23:16:40 +0100 Subject: Return false for exists? with new records - fixes #6199. (cherry picked from commit fa21b73ebb8339ad388f149c817c433b6254d490) --- activerecord/lib/active_record/relation/finder_methods.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (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 9a34927857..4737a194f0 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -185,9 +185,8 @@ module ActiveRecord # Person.exists?(['name LIKE ?', "%#{query}%"]) # Person.exists? def exists?(id = false) - return false if id.nil? - id = id.id if ActiveRecord::Base === id + return false if id.nil? join_dependency = construct_join_dependency_for_association_find relation = construct_relation_for_association_find(join_dependency) -- cgit v1.2.3