From 22fd672efdc66f50826ac7d7ab9cd90718435669 Mon Sep 17 00:00:00 2001 From: riggraz Date: Wed, 9 Oct 2019 15:23:59 +0200 Subject: [PATCH] Fix a bug in comments controller --- app/controllers/comments_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 107862e3..44239a0a 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -34,7 +34,8 @@ class CommentsController < ApplicationController end def update - comment = Comment.find_by(post_id: params[:post_id]) + comment = Comment.find(params[:id]) + comment.assign_attributes(comment_params) if !current_user.power_user? && current_user.id != post.user_id