Class: Spina::Admin::Conferences::EmailAddressValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
app/validators/spina/admin/conferences/email_address_validator.rb

Overview

Validator for email addresses.

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object

Performs validation on the supplied record.

Parameters:

  • record (ActiveRecord::Base)

    the associated record

  • attribute (Symbol)

    the attribute key

  • value (String)

    the attribute value



12
13
14
15
16
# File 'app/validators/spina/admin/conferences/email_address_validator.rb', line 12

def validate_each(record, attribute, value)
  return if value.blank?

  record.errors.add(attribute, :invalid_email_address) unless parse(value)
end