Last active
May 24, 2017 15:38
-
-
Save meltingice/59491e577d7812b6cb94416f85812068 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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