From c64bfdb6528201a3d43e7d36eeb5f9e423c21075 Mon Sep 17 00:00:00 2001 From: Molly Struve Date: Thu, 2 Jan 2020 18:06:05 -0500 Subject: [PATCH] Handle missing commentable for user_is_commentable_author? check (#5336) [deploy] --- app/policies/comment_policy.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/policies/comment_policy.rb b/app/policies/comment_policy.rb index 17b5fc9ed..c59828b07 100644 --- a/app/policies/comment_policy.rb +++ b/app/policies/comment_policy.rb @@ -64,6 +64,6 @@ class CommentPolicy < ApplicationPolicy end def user_is_commentable_author? - record.commentable.user_id == user.id + record.commentable.present? && record.commentable.user_id == user.id end end