class ActiveModel::Validations::PasswordValidator

Constants

REGEXES

Public Instance Methods

validate_each(record, attribute, value) click to toggle source
# File lib/active_validators/active_model/validations/password_validator.rb, line 10
def validate_each(record, attribute, value)
  required_strength = options.fetch(:strength, :weak)
  if (REGEXES[required_strength] !~ value)
    record.errors.add(attribute)
  end
end