Sha256: 3f45b6e5bf114f5f78b3bf3f4f9f950e525050fa24c620aed58912e42af75402
Contents?: true
Size: 535 Bytes
Versions: 3
Compression:
Stored size: 535 Bytes
Contents
# frozen_string_literal: true module Spree # == An ActiveModel Email Validator # # === Usage # # require 'spree/core/validators/email' # # class Person < ApplicationRecord # validates :email_address, 'spree/email' => true # end # class EmailValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) unless Spree::Config.default_email_regexp.match? value record.errors.add(attribute, :invalid, **{ value: }.merge!(options)) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
solidus_core-4.4.2 | lib/spree/core/validators/email.rb |
solidus_core-4.4.1 | lib/spree/core/validators/email.rb |
solidus_core-4.4.0 | lib/spree/core/validators/email.rb |