Class: ActiveModel::Validations::ZipcodeValidator
- Inherits:
-
EachValidator
- Object
- EachValidator
- ActiveModel::Validations::ZipcodeValidator
- Defined in:
- lib/bootstripe-rails/validators.rb
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
4 5 6 |
# File 'lib/bootstripe-rails/validators.rb', line 4 def validate_each(record, attribute, value) record.errors[attribute] << 'is not properly formatted' unless /^[0-9]{5}([- ]?[0-9]{4})?$/.match(value) end |