class ActiveModel::Validations::CnpjValidator
Public Instance Methods
validate_each(record, attribute, value)
click to toggle source
# File lib/validators/validates_cnpj_format_of.rb, line 6 def validate_each(record, attribute, value) return if value.blank? && options[:allow_blank] return if value.nil? && options[:allow_nil] return if CNPJ.valid?(value) record.errors.add( attribute, :invalid_cnpj, message: options[:message], value: value ) end