lib/mongoid/validatable/uniqueness.rb
# Scope the criteria to the scope options provided.
#
# @api private
#
# @example Scope the criteria.
#   validator.scope(criteria, document)
#
# @param [ Criteria ] criteria The criteria to scope.
# @param [ Document ] document The document being validated.
#
# @return [ Criteria ] The scoped criteria.
Scope the criteria to the scope options provided.
Scope the criteria to the scope options provided .
def scope(criteria, document, _attribute)
        Array.wrap(options[:scope]).each do |item|
          name = document.database_field_name(item)
          criteria = criteria.where(item => document.attributes[name])
        end
        criteria
      end
def scope ( criteria , document , _attribute ) Array . wrap ( options [ :scope ] ) . each do | item | name = document . database_field_name ( item ) criteria = criteria . where ( item => document . attributes [ name ] ) end criteria end
Scope the criteria to the scope options provided.
Scope the criteria to the scope options provided .
The scoped criteria.
The scoped criteria .
 Criteria 
criteria
<not_specific>
document
<not_specific>
_attribute
<not_specific>
<not_specific>
document The document being validated.
document The document being validated .
api
None
example
Scope the criteria. validator.scope(criteria, document)
Scope the criteria . validator . scope ( criteria document )