Class: ParanoidStarlight::Validators::EmailValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- ParanoidStarlight::Validators::EmailValidator
- Defined in:
- lib/paranoid_starlight/validators.rb
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/paranoid_starlight/validators.rb', line 7 def validate_each(record, attribute, value) # username in email may have @ in string # username should be case sensitive, domain is not unless value =~ %r{\A([^\s]+)@((?:[-a-zA-Z0-9]+\.)+[a-zA-Z]{2,})\z} record.errors[attribute] << ([:message] || 'is not an email') end end |