From bffdc1f36308e4ae928bd9dbf697a63eb8061fba Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Sun, 19 Apr 2020 16:11:07 +1000 Subject: [PATCH] Ensure content exists --- lib/custom_wizard/builder.rb | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/custom_wizard/builder.rb b/lib/custom_wizard/builder.rb index a44b1192..63fdf75a 100644 --- a/lib/custom_wizard/builder.rb +++ b/lib/custom_wizard/builder.rb @@ -256,17 +256,19 @@ class CustomWizard::Builder with_type: true } ).perform - - if content && content[:type] == 'association' - content[:result] = content[:result].map do |item| - { - id: item[:key], - name: item[:value] - } - end - end - params[:content] = content[:result] + if content.present? + if content[:type] == 'association' + content[:result] = content[:result].map do |item| + { + id: item[:key], + name: item[:value] + } + end + end + + params[:content] = content[:result] + end end field = step.add_field(params)