lib/mongoid/validatable/uniqueness.rb
# Add the error to the document.
#
# @api private
#
# @example Add the error.
#   validator.add_error(doc, :name, "test")
#
# @param [ Document ] document The document to validate.
# @param [ Symbol ] attribute The name of the attribute.
# @param [ Object ] value The value of the object.
Add the error to the document.
Add the error to the document .
def add_error(document, attribute, value)
        document.errors.add(
          attribute, :taken, **options.except(:case_sensitive, :scope).merge(value: value)
        )
      end
def add_error ( document , attribute , value ) document . errors . add ( attribute , :taken , ** options . except ( :case_sensitive , :scope ) . merge ( value : value ) ) end
Add the error to the document.
Add the error to the document .
document
<not_specific>
attribute
<not_specific>
value
<not_specific>
<not_specific>
value The value of the object.
value The value of the object .
api
None
example
Add the error. validator.add_error(doc, :name, "test")
Add the error . validator . add_error ( doc : name " test " )