class Apes::Validators::BaseValidator

The base validator.

Public Instance Methods

validate_each(model, attribute, value) click to toggle source

Perform validation on a attribute of a model.

@param model [Object] The object to validate. @param attribute [String|Symbol] The attribute to validate. @param value [Object] The value of the attribute.

# File lib/apes/validators.rb, line 16
def validate_each(model, attribute, value)
  checked = check_valid?(value)
  return checked if checked

  message = options[:message] || options[:default_message]
  destination = options[:additional] ? model.additional_errors : model.errors
  destination[attribute] << message
  nil
end