Sha256: d0b478a8e30a173e0966ae1e1e0a97041d6338c85184be8c964a5bc7077588a2
Contents?: true
Size: 269 Bytes
Versions: 2
Compression:
Stored size: 269 Bytes
Contents
class UsernameValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) unless value =~ /^[a-z0-9_-]{2,16}$/ record.errors[attribute] << (options[:message] || I18n.t('active_validation.errors.messages.username')) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
active_validation-1.1.0 | lib/active_validation/validators/username_validator.rb |
active_validation-1.0.0 | lib/active_validation/validators/username_validator.rb |