comments: fix N+1 query when loading comment votes.
Doing both `@comments.includes(:votes)` and `comment.votes.active` forced votes to be loaded twice.
This commit is contained in:
@@ -42,7 +42,7 @@ class CommentComponent < ApplicationComponent
|
||||
end
|
||||
|
||||
def current_vote
|
||||
@current_vote ||= comment.votes.active.find { |v| v.user_id == current_user.id }
|
||||
@current_vote ||= comment.active_votes.find { |v| v.user_id == current_user.id }
|
||||
end
|
||||
|
||||
def reported?
|
||||
|
||||
Reference in New Issue
Block a user