Sha256: a2f8c0222aa6fbd5293d3ba1e37d18ec8703be2d4a643ac88fec45d471e6ff2f

Contents?: true

Size: 254 Bytes

Versions: 4

Compression:

Stored size: 254 Bytes

Contents

require "active_model"
require "validates_cnpj/cnpj"

class CnpjValidator < ActiveModel::EachValidator
  def validate_each(record, attribute, value)
    record.errors[attribute] << I18n.t("errors.messages.invalid") unless CNPJ.new(value).valid?
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
validates_cnpj-0.1.2 lib/validates_cnpj.rb
validates_cnpj-0.1.1 lib/validates_cnpj.rb
validates_cnpj-0.1.0 lib/validates_cnpj.rb
validates_cnpj-0.0.1 lib/validates_cnpj.rb