Commit 1cc367e9 authored by Justin Ho's avatar Justin Ho

Fix wrong value of checkbox between Rails / Vue

When a checkbox field is saved in the integration form,
in Rails (without integration_form_refactor ff) it gets saved
as "1" for true and "0" for false, while in Vue we use "true"
and "false". This caused a 1-time transition mismatch
between the values of checkboxes when the feature flag
was enabled.
parent 7315fd5e
...@@ -11,6 +11,8 @@ class ServiceFieldEntity < Grape::Entity ...@@ -11,6 +11,8 @@ class ServiceFieldEntity < Grape::Entity
if field[:type] == 'password' && value.present? if field[:type] == 'password' && value.present?
'true' 'true'
elsif field[:type] == 'checkbox'
ActiveRecord::Type::Boolean.new.deserialize(value).to_s
else else
value value
end end
......
---
title: Fix wrong value of checkbox in integration form
merge_request: 36329
author:
type: fixed
...@@ -68,7 +68,7 @@ RSpec.describe ServiceFieldEntity do ...@@ -68,7 +68,7 @@ RSpec.describe ServiceFieldEntity do
placeholder: nil, placeholder: nil,
required: nil, required: nil,
choices: nil, choices: nil,
value: true value: 'true'
} }
is_expected.to include(expected_hash) is_expected.to include(expected_hash)
......
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