From 41badb15ae094556ce12c7aebbd612ae830897b1 Mon Sep 17 00:00:00 2001 From: KOH6 Date: Sun, 24 Sep 2023 12:11:06 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=AC=E3=83=93=E3=83=A5=E3=83=BC=E5=AF=BE?= =?UTF-8?q?=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/likes_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/likes_controller.rb b/app/controllers/likes_controller.rb index 0fe0972..ba8311f 100644 --- a/app/controllers/likes_controller.rb +++ b/app/controllers/likes_controller.rb @@ -7,7 +7,7 @@ def create end def destroy - @like = Like.find_by(post_id: params[:post_id], user_id: current_user.id) + @like = current_user.likes.find_by(post_id: params[:post_id]) @like.destroy redirect_to request.referer end