Replace BooleanPresenceValidator with InclusionValidator

The `BooleanPresenceValidator` is causing issues with Ruby 3.2+ YJIT irregularly.

Fixes CODEOCEAN-GQ, fixes CODEOCEAN-GR
This commit is contained in:
Sebastian Serth
2023-01-08 14:10:14 +01:00
parent 0a36751896
commit 5d02251cbb
8 changed files with 14 additions and 36 deletions

View File

@ -1,16 +0,0 @@
# frozen_string_literal: true
module ActiveModel
module Validations
class BooleanPresenceValidator < EachValidator
BOOLEAN_VALUES = [false, true].freeze
def validate(record)
[attributes].flatten.each do |attribute|
value = record.send(:read_attribute_for_validation, attribute)
record.errors.add(attribute, nil, **options) unless BOOLEAN_VALUES.include?(value)
end
end
end
end
end