36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/towerdata_email/validators.rb', line 36
def validate_each(record, attribute, value)
return true if handle_nil?(record, attribute, value) || handle_blank?(record, attribute, value)
if eligible_for_validation?(record, attribute)
e = TowerdataEmail.validate_email(value)
if e.incorrect?
if e.corrections && auto_accept_corrections?
record.send(:"#{attribute}=", e.corrections.first)
else
record.errors[attribute] << custom_error_message(default_failure_message(e), e)
end
end
end
end
|