# File lib/active_record/relation/finder_methods.rb, line 171
    def exists?(id = nil)
      id = id.id if ActiveRecord::Base === id

      case id
      when Array, Hash
        where(id).exists?
      else
        relation = select(primary_key).limit(1)
        relation = relation.where(primary_key.eq(id)) if id
        relation.first ? true : false
      end
    end