Sha256: c7e89069e7b53512e9198735cd815cde33454f45b749ea5e60fe7ba34c4ae67d
Contents?: true
Size: 429 Bytes
Versions: 11
Compression:
Stored size: 429 Bytes
Contents
class EmailPatternValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) unless value.match(/^([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,6})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)$/i) record.errors[attribute] << "Not a valid email address" end unless value.blank? end end
Version data entries
11 entries across 11 versions & 1 rubygems