redirect after destroy
This commit is contained in:
parent
8fd1eb3567
commit
1a12aa9798
1 changed files with 5 additions and 1 deletions
|
@ -65,7 +65,11 @@ class Photos < Application
|
||||||
@photo = Photo.find_by_id(params[:id])
|
@photo = Photo.find_by_id(params[:id])
|
||||||
raise NotFound unless @photo
|
raise NotFound unless @photo
|
||||||
if @photo.destroy
|
if @photo.destroy
|
||||||
redirect url(:photos)
|
if @photo.album
|
||||||
|
redirect url(:album, @photo.album)
|
||||||
|
else
|
||||||
|
redirect url(:photos)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
raise BadRequest
|
raise BadRequest
|
||||||
end
|
end
|
||||||
|
|
Reference in a new issue