Sha256: eda11b1813c7d82275133450422da0e45ae63a41ee942bc589d58238723b71b2

Contents?: true

Size: 262 Bytes

Versions: 5

Compression:

Stored size: 262 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('errors.messages.name'))
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
flash_validators-3.0.1 lib/flash_validators/validators/name_validator.rb
flash_validators-3.0.0 lib/flash_validators/validators/name_validator.rb
flash_validators-1.1.0 lib/flash_validators/validators/name_validator.rb
flash_validators-1.0.0 lib/flash_validators/validators/name_validator.rb
flash_validators-0.0.1 lib/flash_validators/validators/name_validator.rb