From 6af2d4339943555ac9ed519a4114e43faeef5289 Mon Sep 17 00:00:00 2001 From: Blair Anderson Date: Sat, 17 Oct 2015 09:44:36 -0700 Subject: [PATCH] prevent exception. --- app/controllers/items_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/items_controller.rb b/app/controllers/items_controller.rb index 3efc0ed..344af71 100644 --- a/app/controllers/items_controller.rb +++ b/app/controllers/items_controller.rb @@ -56,7 +56,7 @@ def set_item end def set_user_item - @item = current_user.items.find(params[:id]) + @item = current_user.items.where(id: params[:id]).first unless @item redirect_to :back, notice: 'Unauthorized' return