Sha256: 0cfbf48fbcc4f45106a1ef67d7534069d8708dba72c12bf5f04603095c9f784b
Contents?: true
Size: 262 Bytes
Versions: 2
Compression:
Stored size: 262 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('yukonisuru.errors.messages.username')) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
yukonisuru-1.0.0 | lib/yukonisuru/validators/username_validator.rb |
yukonisuru-0.0.1 | lib/yukonisuru/validators/username_validator.rb |