Provides a concern for automatically generating Rails validations based on some DB constraints.
Include the concern in ActiveRecord models to get automatic validations
include ConstraintValidations
Including the concern will evaluate database constraints and automatically add the following validations:
- For any column with a not-NULL constraint, it will validate
presence: true
Add this line to your application's Gemfile:
gem 'constraint_validations'
And then execute:
$ bundle
Or install it yourself as:
$ gem install constraint_validations
The gem is available as open source under the terms of the MIT License.