avoid passing AR::Base objects to Arel when we can

This commit is contained in:
Aaron Patterson
2010-08-03 17:57:36 -07:00
parent 7e4e1f0ca5
commit 6d6ed55324

View File

@@ -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?