Class: PostcodeAnywhere::EmailValidation::Validator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- PostcodeAnywhere::EmailValidation::Validator
- Defined in:
- lib/postcode_anywhere/email_validation/validator.rb
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/postcode_anywhere/email_validation/validator.rb', line 6 def validate_each(record, attribute, value) if value.blank? record.errors.add(attribute, :blank, value: value) elsif !PostcodeAnywhere::EmailValidation.valid?(value) record.errors.add(attribute, :invalid, value: value) end end |