module DefraRuby::Validators::CanValidateSelection
Private Instance Methods
value_is_included?(record, attribute, value, valid_options)
click to toggle source
# File lib/defra_ruby/validators/concerns/can_validate_selection.rb, line 9 def value_is_included?(record, attribute, value, valid_options) # In this case, we do want `false.present?` to return `true` https://github.com/rails/rails/issues/10804 return true if (value == false || value.present?) && valid_options.include?(value) add_validation_error(record, attribute, :inclusion) false end