= ActiveValidators
{}[http://badge.fury.io/rb/active_validators]
{}[https://travis-ci.org/nepalez/active_validators]
{}[https://codeclimate.com/github/nepalez/active_validators]
{}[https://gemnasium.com/nepalez/active_validators]
{}[https://coveralls.io/r/nepalez/active_validators]
The plugin provides additional validators for ActiveRecord models.
=== DateValidator
Checks the date is after|before|not after|not before another date.
validates :next_birthday, date: { after: Time.now, not_after: 1.year.from_now }
Use the :allow_nil key to skip validation in case the attribute value isn't set.
validates :next_birthday, date: { after: Time.now, allow_nil: true }
Error messages are translated with a corresponding keys (in a same way as in the Rails Guide[http://guides.rubyonrails.org/i18n.html#translations-for-active-record-models]):
* after_date
* before_date
* not_after_date
* not_before_date
=== TimeValidator
Checks the time is after|before|not after|not before given time (in seconds).
validates :next_alarm, time: { after: Time.now, not_after: 1.day.from_now }
Use the :allow_nil key to skip validation in case the attribute value isn't set.
validates :next_alarm, time: { after: Time.now, allow_nil: true }
Error messages are translated with a corresponding keys (in a same way as in the Rails Guide[http://guides.rubyonrails.org/i18n.html#translations-for-active-record-models]):
* after_time
* before_time
* not_after_time
* not_before_time
=== NotEqualsValidator
Checks if a value not equals to another attibute's value.
validates :finish, not_equals: { to: :start }
Use the :allow_nil key to skip validation in case the attribute value isn't set.
validates :finish, not_equals: { to: :start, allow_nil: true }
Error message is translated with a :not_equals key.
== Installation
Add string to your Gemfile:
gem "active_validators"
== Version changes
See the CHANGELOG[link:CHANGELOG.rdoc].
== License
This project rocks and uses MIT-LICENSE[link:LICENSE].