mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
stop recursively calling exists?
This commit is contained in:
@@ -171,14 +171,16 @@ module ActiveRecord
|
||||
def exists?(id = nil)
|
||||
id = id.id if ActiveRecord::Base === id
|
||||
|
||||
relation = select(primary_key).limit(1)
|
||||
|
||||
case id
|
||||
when Array, Hash
|
||||
where(id).exists?
|
||||
relation = relation.where(id)
|
||||
else
|
||||
relation = select(primary_key).limit(1)
|
||||
relation = relation.where(primary_key.eq(id)) if id
|
||||
relation.first ? true : false
|
||||
end
|
||||
|
||||
relation.first ? true : false
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
Reference in New Issue
Block a user