Commit f5ec38f1 authored by Lucas Charles's avatar Lucas Charles

Chore: correct VulnFeedback enum validation description

We expected to drop this with Rails5.2, expecting
select queries to mirror setter handling for AR enums.
They do not and the design decision is a bit unclear, so we
stick with an explicit validation instead.
queries do not validate 

Relates to https://gitlab.com/gitlab-org/gitlab/-/issues/12814
parent 1c4e2055
...@@ -49,8 +49,8 @@ module Vulnerabilities ...@@ -49,8 +49,8 @@ module Vulnerabilities
record record
end end
# Rails 5.0 does not properly handle validation of enums in select queries such as find_or_initialize_by. # Rails does not validate enums in select queries such as `find_or_initialize_by`,
# This method, and calls to it can be removed when we are on Rails 5.2. # So we raise an ArgumentError early to return a human-readable error
def self.validate_enums(feedback_params) def self.validate_enums(feedback_params)
unless feedback_types.include?(feedback_params[:feedback_type]) unless feedback_types.include?(feedback_params[:feedback_type])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment