aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-08-03 17:57:36 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-08-03 17:58:56 -0700
commit6d6ed5532416aa75889cd34a669696ba640abeb5 (patch)
tree777c49347907d9324f2cee7b5a931e12f5a7c0aa /activerecord
parent7e4e1f0ca5722008b288224221405eba486345c1 (diff)
downloadrails-6d6ed5532416aa75889cd34a669696ba640abeb5.tar.gz
rails-6d6ed5532416aa75889cd34a669696ba640abeb5.tar.bz2
rails-6d6ed5532416aa75889cd34a669696ba640abeb5.zip
avoid passing AR::Base objects to Arel when we can
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/relation/finder_methods.rb2
1 files changed, 2 insertions, 0 deletions
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?