From 91abb856a628419a3d420c14eb397687ebbb0718 Mon Sep 17 00:00:00 2001 From: David Cook Date: Thu, 11 Jan 2024 12:07:50 +1100 Subject: [PATCH] DRY Refactor to use the (previously unused) shared method. --- app/controllers/spree/admin/images_controller.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/spree/admin/images_controller.rb b/app/controllers/spree/admin/images_controller.rb index 4fed1aba31..89e2087c0b 100644 --- a/app/controllers/spree/admin/images_controller.rb +++ b/app/controllers/spree/admin/images_controller.rb @@ -32,7 +32,7 @@ module Spree if @object.save flash[:success] = flash_message_for(@object, :successfully_created) - redirect_to spree.admin_product_images_url(params[:product_id], @url_filters) + redirect_to location_after_save else respond_with(@object) end @@ -44,7 +44,7 @@ module Spree if @object.update(permitted_resource_params) flash[:success] = flash_message_for(@object, :successfully_updated) - redirect_to spree.admin_product_images_url(params[:product_id], @url_filters) + redirect_to location_after_save else respond_with(@object) end @@ -58,7 +58,7 @@ module Spree flash[:success] = flash_message_for(@object, :successfully_removed) end - redirect_to spree.admin_product_images_url(params[:product_id], @url_filters) + redirect_to location_after_save end private @@ -76,7 +76,7 @@ module Spree end def location_after_save - spree.admin_product_images_url(@product) + spree.admin_product_images_url(params[:product_id], @url_filters) end def load_data