From ab23c5b8735ab24bf4f540ad43646855e1cfbe41 Mon Sep 17 00:00:00 2001 From: KOH6 Date: Wed, 20 Sep 2023 15:00:41 +0900 Subject: [PATCH] =?UTF-8?q?rails=5Fbest=5Fpractices=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index e025df3..99e98a6 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -10,7 +10,7 @@ def show end def edit - return unless current_user != User.find(params[:id]) + return unless current_user.id != params[:id].to_i redirect_to user_path(current_user), flash: { danger: '自分以外のプロフィールは編集できません。' } nil