Voting

Allow for AJAXy voting on comments and articles. Resolves #14.


![](http://zippy.gfycat.com/ImpracticalPastCardinal.gif)
Thoughts on this refactoring?

```rb
def vote_arrow(direction, votable)
  vote = Vote.find_by(user: current_user, votable: votable)

  classes = %W[#{direction} vote].tap do |classes|
    if vote && (vote.up? && direction == 'up') || (vote.down? && direction == 'down')
      classes << 'clicked'
    end
  end

  content_tag :div, '', class: classes.join(' ')
end
```

The `up?` and `down?` convenience methods on `vote` were a suggestion of mine above.