Apress::Validators
Validators for ActiveRecord and ActiveModel.
Installation
Add this line to your application's Gemfile:
gem 'apress-validators'
And then execute:
$ bundle install
Available Validators
CountValidator
- behaves similarly to LengthValidator
, but designed only for associated records. Does not count records
that are marked for destruction. Takes the same options as LengthValidator
.
validates :image, :count => {:maximum => 24}
validates :image, :count => {:minimum => 2, message: 'Must have at lest 2 images'}
validates :image, :count => {:is => 3, :allow_nil => true}
Contributing
- Fork it ( https://github.com/[my-github-username]/apress-validators/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request