From 0f77d1bad50e1f6504401ade9a509fbce0345095 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 e5b35473ac..141c02272a 100644 --- a/app/controllers/admin/enterprises_controller.rb +++ b/app/controllers/admin/enterprises_controller.rb @@ -49,8 +49,11 @@ module Admin @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