MoreValidators
==============
Rails gem/plugin is a series of validators provided by me or other people:
ValidateAsEmail: http://github.com/gbdev/validates_as_email
It's released under Creative Commons Attribution-Share Alike 3.0 Unported License.
Talk to me if you have any questions:
Rafael Barbolo: rafael@barbolo.com.br
http://twitter.com/barbolo
Installation:
=============
Install the gem(s):
gem install more_validators
Add to environment.rb initializer block:
config.gem 'more_validators', :lib => 'validates_as_'
LatestVersion
--------------
Version: 0.1.3
--------------
Usage:
======
In your model file do something like:
class MyClass < ActiveRecord::Base
# Email validation
validates_as_email :email, :message => 'Invalid', :allow_nil => true, :allow_blank => true
# Brazilian postal code validation
validates_as_cep :cep, :message => 'Invalid', :allow_nil => true, :allow_blank => true
# Brazilian phone number validation
validates_as_phonenumber_br :phonenumber, :message => 'Invalid', :allow_nil => true, :allow_blank => true
# CPF validation
validates_as_cpf :cpf, :message => 'Invalid', :allow_nil => true, :allow_blank => true
# CNPJ validation
validates_as_cnpj :cnpj, :message => 'Invalid', :allow_nil => true, :allow_blank => true
# Brazilian UF validation, both upcase and downcase are allowed by default
validates_as_uf_br :uf, :allow_up => true, :allow_down => true
end
Tests:
======
Some tests have been added to each validator.
License:
========
See the LICENSE file.