From 8a9d585572fa3887fc81988a866904382cf20d06 Mon Sep 17 00:00:00 2001 From: Alex Dolski Date: Tue, 16 Jan 2024 08:52:49 -0600 Subject: [PATCH] Improve redirect in destroy() --- app/controllers/imports_controller.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/controllers/imports_controller.rb b/app/controllers/imports_controller.rb index 11e9f0f5..5fbd146f 100644 --- a/app/controllers/imports_controller.rb +++ b/app/controllers/imports_controller.rb @@ -71,11 +71,8 @@ def destroy message: "The import into \"#{@import.collection.title}\" has "\ "been deleted.") ensure - if current_user_is_sysadmin? - redirect_to institution_path(institution) - else - redirect_to imports_path - end + redirect_back fallback_location: current_user_is_sysadmin? ? + institution_path(institution) : imports_path end ##