Sha256: 2a1ab58af64b818d9ee3eafc0d558030417ee56334bbe03b27da12fcc9f6717a
Contents?: true
Size: 247 Bytes
Versions: 35
Compression:
Stored size: 247 Bytes
Contents
class EmailValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) record.errors.add attribute, (options[:message] || "is not an email") unless value =~ /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i end end
Version data entries
35 entries across 35 versions & 1 rubygems