Sha256: c458d3a19501e54544b992f9fbe24c922d11ebd379c29960109bb1adc1c62b42
Contents?: true
Size: 374 Bytes
Versions: 292
Compression:
Stored size: 374 Bytes
Contents
# An ActiveRecord validator for any email field that you would use with effective_email or otherwise # # validates :email, email: true class EmailValidator < ActiveModel::EachValidator PATTERN = /\A.+@.+\..+\Z/ def validate_each(record, attribute, value) if value.present? record.errors.add(attribute, 'is invalid') unless PATTERN =~ value end end end
Version data entries
292 entries across 292 versions & 1 rubygems