Sha256: 561b9c4fc28435b2ee2ad1b7f084d4872bec49eb18d79d0c50ef1fce8f767f0b
Contents?: true
Size: 626 Bytes
Versions: 6
Compression:
Stored size: 626 Bytes
Contents
require 'active_model' require 'active_model/validations' require 'mail' require 'valid_email/validate_email' class BanDisposableEmailValidator < ActiveModel::EachValidator # A list of disposable email domains def self.config=(options) @@config = options end # Required to use config outside def self.config @@config = [] unless defined? @@config @@config end def validate_each(record, attribute, value) r = ValidateEmail.ban_disposable_email?(value) record.errors.add attribute, (options[:message] || I18n.t(:invalid, :scope => "valid_email.validations.email")) unless r r end end
Version data entries
6 entries across 6 versions & 1 rubygems