From 0866d71effeccd80db6dd997b2738ce0dc255cde Mon Sep 17 00:00:00 2001 From: Dan Barber Date: Thu, 20 Aug 2015 15:42:06 +0100 Subject: [PATCH] Redirect back rather than to the index This fixes the issue where it returns to page 1 if you destroy a photo on a subsequent page. --- app/controllers/admin/photos_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/admin/photos_controller.rb b/app/controllers/admin/photos_controller.rb index c94bbad..41041c5 100644 --- a/app/controllers/admin/photos_controller.rb +++ b/app/controllers/admin/photos_controller.rb @@ -37,7 +37,7 @@ class Admin::PhotosController < Admin::AdminController @photo = Photo.find(params[:id]) @photo.destroy - redirect_to admin_photos_path, notice: 'Photo was deleted.' + redirect_to :back, notice: 'Photo was deleted.' end private