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.
Add on your Gemfile :
On the console :
gem install evelpidon_validators
On your code :
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/greater'
# 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
- 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.
Evelpidon Validators are released under the MIT license. See LICENSE for more details.