redirect after destroy
parent
8fd1eb3567
commit
1a12aa9798
|
@ -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 New Issue