From 5cd50b1c1ff66398f470d51fdafacf26663a2730 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Turbelin?= Date: Thu, 26 Dec 2024 17:06:32 +0100 Subject: [PATCH] Use params value only if present --- app/controllers/admin/enterprises_controller.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin/enterprises_controller.rb b/app/controllers/admin/enterprises_controller.rb index e5b35473acd..141c02272a6 100644 --- a/app/controllers/admin/enterprises_controller.rb +++ b/app/controllers/admin/enterprises_controller.rb @@ -49,8 +49,11 @@ def edit @object.build_custom_tab if @object.custom_tab.nil? return unless params[:stimulus] - @enterprise.is_primary_producer = params[:is_primary_producer] - @enterprise.sells = params[:enterprise_sells] + if params[:is_primary_producer].present? + @enterprise.is_primary_producer = params[:is_primary_producer] + end + @enterprise.sells = params[:enterprise_sells] if params[:enterprise_sells].present? + render cable_ready: cable_car.morph("#side_menu", partial("admin/shared/side_menu")) .morph("#permalink", partial("admin/enterprises/form/permalink")) end