module ActiveModel::Validations::HelperMethods

Public Instance Methods

validates_email(*attr_names) click to toggle source

Validates email

Configuration options:

  • :check_mx - Check MX record for domain

  • :not_disposable - Check that this is not a disposable email

  • :not_free - Not a free email (ex. gmail.com, hotmail.com)

  • :not_blacklisted - If domain is on the blacklist, reject it

  • :block_special_usernames - If the username is one of the special usernames, reject it

# File lib/email_check/helper_methods.rb, line 12
def validates_email(*attr_names)
  validates_with EmailValidator, _merge_attributes(attr_names)
end
validates_email_strictness(*attr_names) click to toggle source

Turn everything on..

# File lib/email_check/helper_methods.rb, line 17
def validates_email_strictness(*attr_names)
  validates_with EmailValidator, _merge_attributes(attr_names).merge(
                                   :check_mx => true,
                                   :not_disposable => true,
                                   :not_free => true,
                                   :not_blacklisted => true,
                                   :block_special_usernames => true)
end