Sha256: 13356faba7e9ae27ea1164e4b229e5078d922067faa10e814e0cdb7cc08dcd39
Contents?: true
Size: 461 Bytes
Versions: 42
Compression:
Stored size: 461 Bytes
Contents
class EmailValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) unless value =~ %r{\A(([A-Za-z0-9]+_+)| ([A-Za-z0-9]+\-+)| ([A-Za-z0-9]+\.+)| ([A-Za-z0-9]+\++))*[A-Za-z0-9_]+@((\w+\-+)| (\w+\.))*\w{1,63}\.[a-zA-Z]{2,6}\z}xi record.errors.add(attribute, :invalid, { value: value }.merge!(options)) end end end
Version data entries
42 entries across 42 versions & 1 rubygems