Sha256: b1ddcc84da7879a03ff3efd5e9d44ea6ca06cfe020e51ead8e5cafbb0bcdbb08
Contents?: true
Size: 367 Bytes
Versions: 16
Compression:
Stored size: 367 Bytes
Contents
require 'mail' class EmailValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) begin parsed = Mail::Address.new(value) rescue Mail::Field::ParseError => e end record.errors.add attribute, "is not valid" unless !parsed.nil? && parsed.address == value && parsed.local != value #cannot be a local address end end
Version data entries
16 entries across 16 versions & 1 rubygems