Sha256: 17a7585c883f36751059a529b788d0b563586d10afc8869e86cd31264c2aa81c

Contents?: true

Size: 273 Bytes

Versions: 6

Compression:

Stored size: 273 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('active_validation.errors.messages.boolean'))
    end
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
active_validation-2.2.1 lib/active_validation/validators/boolean_validator.rb
active_validation-2.2.0 lib/active_validation/validators/boolean_validator.rb
active_validation-2.0.1 lib/active_validation/validators/boolean_validator.rb
active_validation-2.0.0 lib/active_validation/validators/boolean_validator.rb
active_validation-1.1.0 lib/active_validation/validators/boolean_validator.rb
active_validation-1.0.0 lib/active_validation/validators/boolean_validator.rb