class EmailDetected::ValidatesExistEmail::Validator::EmailExistValidator
Public Instance Methods
validate_each(record, attribute, value)
click to toggle source
# File lib/email_detected/validates_exist_email.rb, line 11 def validate_each(record, attribute, value) begin m = Mail::Address.new(value) r = !m.domain.nil? && m.domain.match('\.') && m.address == value r = EmailDetected.exist? m.address r = r[:status] rescue StandardError r = false end unless r record.errors[attribute] << (options[:message] || 'does not exist') end end