Sha256: ea76254bb322631d6dca383031d3fd0a1c09568181a30e84003d6a5e96aba25b

Contents?: true

Size: 266 Bytes

Versions: 1

Compression:

Stored size: 266 Bytes

Contents

class CpfValidator < ActiveModel::EachValidator
  def validate_each(record, attribute, value)
    unless ValidateCpf::Cpf.new(value).valid?
      record.errors[attribute] << (options[:message] || I18n.t("errors.messages.this_document_is_invalid"))
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
validate_cpf-1.0.0 lib/validate_cpf/cpf_validator.rb