From 6d6ed5532416aa75889cd34a669696ba640abeb5 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 3 Aug 2010 17:57:36 -0700 Subject: avoid passing AR::Base objects to Arel when we can --- 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 a192e044ea..bad9af250d 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -169,6 +169,8 @@ module ActiveRecord # Person.exists?(['name LIKE ?', "%#{query}%"]) # Person.exists? def exists?(id = nil) + id = id.id if ActiveRecord::Base === id + case id when Array, Hash where(id).exists? -- cgit v1.2.3