From 78a1fa18f221c7b866576c1ade4f7856fb13e31e Mon Sep 17 00:00:00 2001 From: Bohung Date: Wed, 8 Jun 2022 21:15:06 +0800 Subject: [PATCH] Fix bug. --- app/controllers/seminars_controller.rb | 27 +++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/app/controllers/seminars_controller.rb b/app/controllers/seminars_controller.rb index d15b58d..9137d7a 100644 --- a/app/controllers/seminars_controller.rb +++ b/app/controllers/seminars_controller.rb @@ -533,23 +533,24 @@ class SeminarsController < ApplicationController def update @con = SeminarSignupContribute.find(params[:seminar_signup_contribute][:id]) update_params = seminar_signup_contribute_params.merge('seminar_submission_values'=>params['seminar_submission_values']) - flag = true update_params.permit! - if update_params['seminar_submission_values']['0']['value'].class==String - value = update_params['seminar_submission_values']['0']['value'] - if !value.to_s.blank? - flag = false - end - else - update_params['seminar_submission_values']['0']['value'].each do |key,value| - if !value.to_s.blank? + unless update_params['seminar_submission_values'].nil? + flag = true + if update_params['seminar_submission_values']['0']['value'].class==String + value = update_params['seminar_submission_values']['0']['value'] + if !value.to_s.blank? flag = false end + else + update_params['seminar_submission_values']['0']['value'].each do |key,value| + if !value.to_s.blank? + flag = false + end + end + end + if flag + update_params['seminar_submission_values']['0']['value']['en'] = ' ' end - end - - if flag - update_params['seminar_submission_values']['0']['value']['en'] = ' ' end @con.update_attributes(update_params) if @con.save