Evelpidon Validators (for Rails / ActiveModel / ActiveRecord)
Collection of various ActiveModel validators, alongside their client side implementation as ClientSideValidations::Middleware (see ClientSideValidations for more info). Client side validations are optional and are enabled only if the client_side_validations gem is already loaded.
Validators
- Different
- Less
- More
- Associated
- Credit Card
Installation
Bundler
Add on your Gemfile :
gem 'evelpidon_validators'
By hand
On the console :
gem install evelpidon_validators
On your code :
require 'evelpidon_validators'
Usage
Validators are not automatically loaded. You can require the validators you need either explicitly one-by-one or all of them. So for example :
# Load only "Greater than" and "Less than" validators :
require 'evelpidon_validators/greater'
require 'evelpidon_validators/less'
or
# Load everything
require 'evelpidon_validators/all'
Enable client side validations support
Client-side validations work out of the box with Rails 3.1 (through the asset pipeline) :
- Configure / initialize ClientSideValidations (gem, js, etc...) per it's documentation.
- Require the 'evelpidon_validators' js. This will be served through the asset pipeline
So for example the following should work :
//= require rails.validations
//= require evelpidon_validators
TODOs
- Better documentation
- Gather other useful validations found around the net...
Note on Patches/Pull Requests
- Fork the project.
- Make your feature addition or bug fix.
- Add tests for it. This is important so I don't break it in a future version unintentionally (not really...).
- Commit, do not mess with gemspec, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
- Send a pull request. Bonus points for topic branches.
Author(s)
Copyright
- Copyrignt (c) 2011 E-Travel S.A.
- Copyrignt (c) 2011 Fraudpointer.com
License
Evelpidon Validators are released under the MIT license. See LICENSE for more details.