Sha256: a05649cd929ab68fdbef475d5b3957ea06d7f9b165298bf0deb0b1598ce75c8b
Contents?: true
Size: 391 Bytes
Versions: 1
Compression:
Stored size: 391 Bytes
Contents
require "active_model" require "validates_cpf/cpf" require "shoulda-matchers/validate_as_cpf_matcher" if defined?(Shoulda) require "remarkable/validate_as_cpf_matcher" if defined?(Remarkable) class CpfValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) record.errors[attribute] << I18n.t("errors.messages.invalid") unless CPF.new(value).valid? end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
validates_cpf-0.2.0 | lib/validates_cpf.rb |