Sha256: a054f1fc24c2202e645859a3d0c919b10a419486e743de15ca7483e643bb21ef

Contents?: true

Size: 273 Bytes

Versions: 2

Compression:

Stored size: 273 Bytes

Contents

class NameValidator < ActiveModel::EachValidator

  def validate_each(record, attribute, value)
    unless value =~ /\A([a-zA-Z'-]+\s+){1,4}[a-zA-Z'-]*\z/i
      record.errors[attribute] << (options[:message] || I18n.t('yukonisuru.errors.messages.name'))
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
yukonisuru-1.0.0 lib/yukonisuru/validators/name_validator.rb
yukonisuru-0.0.1 lib/yukonisuru/validators/name_validator.rb