BooleanValidator

This gem enables your Rails-based app to validate boolean values much easier.

Installation

Add this line to your application's Gemfile:

gem 'boolean_validator'

And then execute:

$ bundle install

Usage

In your model:

class Post
  include ActiveModel::Model
  validates :is_public, boolean: true
end

or you can pass an option like:

class Post
  include ActiveModel::Model
  validate :is_public, boolean: { message: 'Customize your error message' }
end

Contributing

License

The gem is available as open source under the terms of the MIT License.