Sha256: bf0fa60f685ffa7d9df0f84c5755af83e5df087384d52a9f3370504e2cab0b99
Contents?: true
Size: 266 Bytes
Versions: 2
Compression:
Stored size: 266 Bytes
Contents
class BooleanValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) unless [true, false, 1, 0].include?(value) record.errors[attribute] << (options[:message] || I18n.t('yukonisuru.errors.messages.boolean')) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
yukonisuru-1.0.0 | lib/yukonisuru/validators/boolean_validator.rb |
yukonisuru-0.0.1 | lib/yukonisuru/validators/boolean_validator.rb |