From b0223cc62d626f166987bfc2100be6dd652d19cc Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Tue, 5 Jun 2018 13:11:52 +1000 Subject: [PATCH] Ensure all checkboxes are boolean when validating --- lib/builder.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/builder.rb b/lib/builder.rb index 44a5888c..21e38da1 100644 --- a/lib/builder.rb +++ b/lib/builder.rb @@ -213,6 +213,11 @@ class CustomWizard::Builder label = field['label'] || I18n.t("#{field['key']}.label") updater.errors.add(field['id'].to_s, I18n.t('wizard.field.too_short', label: label, min: min_length.to_i)) end + + ## ensure all checkboxes are booleans + if field['type'] === 'checkbox' + updater.fields[field['id']] = value == true + end end def create_topic(user, action, data)