Class: PciuAddressLineValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/evss/pciu_address/pciu_address_line_validator.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



4
5
6
7
8
# File 'lib/evss/pciu_address/pciu_address_line_validator.rb', line 4

def validate_each(record, attribute, value)
  unless value =~ %r{\A[-a-zA-Z0-9 "#%&'()+,./:@]+\z} || value.blank?
    record.errors.add(attribute, "must only contain letters, numbers, and the special characters #%&'()+,./:@')")
  end
end