Skip to content

Instantly share code, notes, and snippets.

@meltingice
Last active May 24, 2017 15:38
Show Gist options
  • Save meltingice/59491e577d7812b6cb94416f85812068 to your computer and use it in GitHub Desktop.
Save meltingice/59491e577d7812b6cb94416f85812068 to your computer and use it in GitHub Desktop.
def member_is_blocking?(other_member)
blocked_member_ids.include?(other_member['id'])
end
def blocked_member_ids
return [] if @current_member.nil?
@blocked_member_ids ||= @current_member.blocked_members.pluck(:id)
end
def member_has_voted?(comment)
return false if @current_member.nil?
voted_comment_ids.include?(comment['id'])
end
def voted_comment_ids
@voted_comment_ids ||= CommentVote.where(
comment: @article.comments.visible.pluck(:id),
member: @current_member
).pluck(:comment_id)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment