redirect after destroy

master
Andrew Coleman 2009-03-21 21:31:34 -05:00
parent 8fd1eb3567
commit 1a12aa9798
1 changed files with 5 additions and 1 deletions

View File

@ -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