1
0
Fork 0

stripe whitespace when validating length

Dieser Commit ist enthalten in:
Angus McLeod 2019-01-22 13:11:42 +11:00
Ursprung cfb93e2adb
Commit 3a5d3a0687

Datei anzeigen

@ -229,7 +229,7 @@ class CustomWizard::Builder
value = updater.fields[field['id']] value = updater.fields[field['id']]
min_length = field['min_length'] min_length = field['min_length']
if min_length && value.is_a?(String) && value.length < min_length.to_i if min_length && value.is_a?(String) && value.strip.length < min_length.to_i
label = field['label'] || I18n.t("#{field['key']}.label") 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)) updater.errors.add(field['id'].to_s, I18n.t('wizard.field.too_short', label: label, min: min_length.to_i))
end end