Sha256: db8e0c730b3a527691d3234f3171dcadee5c68177711a553052aaa529fc7df43

Contents?: true

Size: 349 Bytes

Versions: 1

Compression:

Stored size: 349 Bytes

Contents

class CpfValidator < ActiveModel::EachValidator
  def validate_each(record, attribute, value)
    key = :"activerecord.errors.models.#{record.class.name.underscore}.attributes.#{attribute}.invalid"
    record.errors.add(attribute, I18n.t(key, :default => :'activerecord.errors.messages.invalid')) unless ValidatesCpf::Cpf.new(value).valid?
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
validates_cpf-2.0.0.rc1 lib/cpf_validator.rb