From 22c37e3cb82c290de6284297b0e7580ad794c7b8 Mon Sep 17 00:00:00 2001 From: Bohung Date: Tue, 14 Jun 2022 21:32:48 +0800 Subject: [PATCH] Fix bug. --- .../admin/application_forms_controller.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/controllers/admin/application_forms_controller.rb b/app/controllers/admin/application_forms_controller.rb index 62de4c7..2d23956 100644 --- a/app/controllers/admin/application_forms_controller.rb +++ b/app/controllers/admin/application_forms_controller.rb @@ -436,6 +436,7 @@ class Admin::ApplicationFormsController < OrbitAdminController end end def copy + @application_form_setting = ApplicationFormSetting.first @application_form = ApplicationFormMain.find(params[:id]).clone_new @members = @application_form.reviewer_ids_list.collect{|r_ids| MemberProfile.where(:id.in=>Array(r_ids)).to_a} @@ -863,9 +864,15 @@ class Admin::ApplicationFormsController < OrbitAdminController params.require(:application_form_template_setting).permit! end def application_form_params - tmp = params.require(:application_form_main).permit! - tmp['reviewer_ids_list'] = tmp['reviewer_enables'].map{|k,i| Array((tmp['reviewer_ids_list'][k] rescue []))} - tmp['reviewer_enables'] = tmp['reviewer_enables'].map{|k,v| v.to_i != 0 ? true : false} + if params.has_key?(:application_form_main) + tmp = params.require(:application_form_main).permit! + if tmp['reviewer_enables'] + tmp['reviewer_ids_list'] = tmp['reviewer_enables'].map{|k,i| Array((tmp['reviewer_ids_list'][k] rescue []))} + tmp['reviewer_enables'] = tmp['reviewer_enables'].map{|k,v| v.to_i != 0 ? true : false} + end + else + tmp = {} + end tmp end def create_set (save_flag)