EricLowber/Bloccit — pull request #6 by EricLowber (2014-11-20 16:36:13+00:00)
Title: cleaned up voter view

I did finally have to peek at the bloccit repo, but I understand what is going on here:

def up_vote_link_classes(post)
arrow = "glyphicon glyphicon-chevron-up "
vote = current_user.voted(post)
arrow += "voted" if vote && vote.up_vote?
arrow
end

When a user clicks the up-vote, the link in the _voter partial calls the up_vote_link_classes helper method. Rather than having one long line of syntax as before, "glyphicon glyphicon-chevron-up " is assigned to "arrow", "current_user.voted(post)" is assigned to vote, and the two variables are placed in a conditional that evaluates whether or not the current has voted, and if so, whether or not the user has voted "up". If this evaluates true, the arrow and vote variables are strung together with the shorthand operator +=. Arrow, now with a chevron possessing a lower opacity, is then called again on the last line of the method, since in Ruby the last line is the line returned by the method.