ValidatesCPF <img src=“https://secure.travis-ci.org/plribeiro3000/validates_cpf.png” />
Rails gem to validate CPF. Don’t forget to check ValidatesCnpj, ValidatesTelephone and ValidatesHost.
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 builtin matchers for shoulda-matchers and remarkable.
Notes
Since version 1.0.0, it isn’t necessary to load any file inside your spec_helper anymore.
Contribute
Fork the project and send me a Pull Request. =D