Sha256: e64b53a5b36d3c747b85d9972daaaf326c8ab4c407ed7b29ce5934c8f4514c3a
Contents?: true
Size: 503 Bytes
Versions: 1
Compression:
Stored size: 503 Bytes
Contents
require "validates_cnpj/cnpj" #Rspec Matchers require "validates_cnpj/shoulda-matchers/require_a_valid_cnpj_matcher" if defined?(::Shoulda) require "validates_cnpj/remarkable/require_a_valid_cnpj_matcher" if defined?(::Remarkable) class CnpjValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) record.errors[attribute] << I18n.t("activerecord.errors.models.#{record.class.name.downcase}.attributes.#{attribute.to_s}.invalid") unless CNPJ.new(value).valid? end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
validates_cnpj-1.1.0 | lib/validates_cnpj.rb |