From 1a12aa979819f4dc83b7a0dd114b6e941d0a44b5 Mon Sep 17 00:00:00 2001 From: Andrew Coleman Date: Sat, 21 Mar 2009 21:31:34 -0500 Subject: [PATCH] redirect after destroy --- app/controllers/photos.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/photos.rb b/app/controllers/photos.rb index 4472e24..fec02bd 100644 --- a/app/controllers/photos.rb +++ b/app/controllers/photos.rb @@ -65,7 +65,11 @@ class Photos < Application @photo = Photo.find_by_id(params[:id]) raise NotFound unless @photo if @photo.destroy - redirect url(:photos) + if @photo.album + redirect url(:album, @photo.album) + else + redirect url(:photos) + end else raise BadRequest end