From 8a6870b8ff8c8602054aa93ca2ed163eed720d66 Mon Sep 17 00:00:00 2001 From: Paul Bob Date: Sat, 28 Sep 2024 22:00:40 +0300 Subject: [PATCH] fix destroy --- app/controllers/avo/base_controller.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/controllers/avo/base_controller.rb b/app/controllers/avo/base_controller.rb index b135f1d42..b28a41896 100644 --- a/app/controllers/avo/base_controller.rb +++ b/app/controllers/avo/base_controller.rb @@ -537,9 +537,19 @@ def resource_view_response_path end def destroy_success_action + flash[:notice] = destroy_success_message + respond_to do |format| - format.html { redirect_to after_destroy_path, notice: destroy_success_message } - format.turbo_stream { render turbo_stream: turbo_stream.turbo_frame_reload(params[:turbo_frame]) } + if params[:turbo_frame] + format.turbo_stream do + render turbo_stream: [ + turbo_stream.turbo_frame_reload(params[:turbo_frame]), + turbo_stream.flash_alerts + ] + end + else + format.html { redirect_to after_destroy_path } + end end end