Use params value only if present

This commit is contained in:
François Turbelin
2024-12-26 17:06:32 +01:00
committed by Rachel Arnould
parent cd38e02cac
commit 0f77d1bad5

View File

@@ -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