README.markdown in acts_as_votable-0.1.3 vs README.markdown in acts_as_votable-0.2.0

- old
+ new

@@ -75,16 +75,43 @@ @post.vote :voter => @user5, :vote => 'like' # negative votes @post.downvote_from @user2 @post.vote :voter => @user2, :vote => 'bad' - + # tally them up! @post.votes.size # => 5 @post.likes.size # => 3 @post.upvotes.size # => 3 @post.dislikes.size # => 2 @post.downvotes.size # => 2 + +Active Record scopes are provided to make life easier. + + @post.votes.up.by_type(User) + @post.votes.down + @user1.votes.up + @user1.votes.down + @user1.votes.up.by_type(Post) + +Once scoping is complete, you can also trigger a get for the +voter/votable + + @post.votes.up.by_type(User).voters + @post.votes.down.by_type(User).voters + + @user.votes.up.for_type(Post).votables + @user.votes.up.votables + +You can also 'unvote' a model to remove a previous vote. + + @post.liked_by @user1 + @post.unlike_by @user1 + + @post.disliked_by @user1 + @post.undisliked_by @user1 + +Unvoting works for both positive and negative votes. ### The Voter You can have your voters ``acts_as_voter`` to provide some reserve functionality.