Sha256: 638f5df17c8fff40467eb21a95417294f98f7d06988427752d450dcce898966b
Contents?: true
Size: 268 Bytes
Versions: 11
Compression:
Stored size: 268 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('flash_validators.errors.messages.username')) end end end
Version data entries
11 entries across 11 versions & 1 rubygems