Class: EmailValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Includes:
EmailRegexp
Defined in:
lib/validates/email_validator.rb

Instance Method Summary collapse

Methods included from EmailRegexp

#regexp_compare

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



4
5
6
7
8
# File 'lib/validates/email_validator.rb', line 4

def validate_each(record, attribute, value)
  unless regexp_compare(value)
    record.errors.add(attribute, :email, options.merge(:value => value))
  end
end