From 2bdf8e2853a03980e5c503e10edda96d78f08d56 Mon Sep 17 00:00:00 2001 From: Ahmed Ejaz Date: Fri, 24 May 2024 02:40:34 +0500 Subject: [PATCH] rename destroy.turbo_stream to make it more generic --- app/controllers/admin/products_v3_controller.rb | 6 +++--- app/views/admin/products_v3/destroy.turbo_stream.haml | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) delete mode 100644 app/views/admin/products_v3/destroy.turbo_stream.haml diff --git a/app/controllers/admin/products_v3_controller.rb b/app/controllers/admin/products_v3_controller.rb index 52d26bd924..b4968e0a2f 100644 --- a/app/controllers/admin/products_v3_controller.rb +++ b/app/controllers/admin/products_v3_controller.rb @@ -32,19 +32,19 @@ module Admin end def destroy - @product = ProductScopeQuery.new( + @record = ProductScopeQuery.new( spree_current_user, { id: params[:id] } ).find_product - if @product.destroy + if @record.destroy flash[:success] = I18n.t('admin.products_v3.delete_product.success') else flash[:error] = I18n.t('admin.products_v3.delete_product.error') end respond_with do |format| - format.turbo_stream + format.turbo_stream { render :destroy_product_variant } end # using flash with turbo stream doesn't clear it because the page is not refreshed. diff --git a/app/views/admin/products_v3/destroy.turbo_stream.haml b/app/views/admin/products_v3/destroy.turbo_stream.haml deleted file mode 100644 index f517ebc6cd..0000000000 --- a/app/views/admin/products_v3/destroy.turbo_stream.haml +++ /dev/null @@ -1,2 +0,0 @@ -= turbo_stream.remove dom_id(@product) -= render partial: "admin/shared/flashes", locals: { flashes: flash } if defined? flash \ No newline at end of file