Sha256: da6f492fbd31890ce8370d939eb3f31859e4f43d0f2c661731802563381a1568
Contents?: true
Size: 1.13 KB
Versions: 1
Compression:
Stored size: 1.13 KB
Contents
= ValidatesCPF {<img src="https://secure.travis-ci.org/plribeiro3000/validates_cpf.png" />}[http://travis-ci.org/plribeiro3000/validates_cpf] Rails gem to validate CPF. Don't forget to check {ValidatesCnpj}[https://github.com/plribeiro3000/validates_cnpj] and {ValidatesTelephone}[https://github.com/plribeiro3000/validates_telephone]. == Install gem install validates_cpf == Usage Lets say you have a model with "cpf" string column that you want to be a valid CPF. Just add this to your model: class User < ActiveRecord::Base validates :cpf, :cpf => true end == Test This gem has matchers for shoulda-matchers and remarkable. If you are using shoulda-matchers, add this line to your spec_helper.rb : require "validates_cpf/shoulda-matchers/validate_as_cpf_matcher" If you are using remarkable, add this line to your spec_helper.rb : require "validates_cpf/remarkable/validate_as_cpf_matcher" === How? You should use validates_as_cpf(:attribute) just like any other shoulda or remarkable matcher. == Goal This project is based on brcpfcnpj gem and his intention it to mantain a cleaner code to validate CPF and easy matchers to test it.
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
validates_cpf-0.2.2 | README.rdoc |