Skip to content

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

License

Notifications You must be signed in to change notification settings

ayumitamai97/boolean_validator

Repository files navigation

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

  • Note: With ActiveRecord, this validation does not work functionally and just work as column type declaration.
  • Implementation for ActiveRecord is here: #4
  • Bug reports and your opinions are welcome.

License

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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages