Explorar o código

Ensure all checkboxes are boolean when validating

Angus McLeod %!s(int64=6) %!d(string=hai) anos
pai
achega
b0223cc62d
Modificáronse 1 ficheiros con 5 adicións e 0 borrados
  1. 5 0
      lib/builder.rb

+ 5 - 0
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)