Class: Validations::EmailValidator

Inherits:
EachValidator
  • Object
show all
Defined in:
lib/strobe/validations.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attr, val) ⇒ Object



16
17
18
19
# File 'lib/strobe/validations.rb', line 16

def validate_each(record, attr, val)
  return if val.blank? || val =~ /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i
  record.errors[attr] << "is not a valid email address"
end