ryanto/acts_as_votable — pull request #25 by leizzer (2013-01-18 22:56:33+00:00)
Title: Adding Scopes to votes

I added the ability to manage scopes for votes.

Creating

@post.liked_by @user1, :vote_scope => 'rank'
@post.vote :voter => @user3, :vote_scope => 'rank'

Finding

@post.find_votes(:vote_scope => 'rank')
@post.likes(:vote_scope => 'rank')

* Votes with scope
* One user can vote a votable multiple times with different scope
* One user can only vote a votable once under the same scope
* You can create and search using vote_scope filter.
* Tests passing
* Added tests for Voter and Votable

Votable model can be voted under different scopes by the same user

@post.vote :voter => @user1, :vote_scope => 'week'
@post.vote :voter => @user1, :vote_scope => 'month'

@post.votes.size # => 2
@post.find_votes(:vote_scope => 'week').size # => 1
@post.find_votes(:vote_scope => 'month').size # => 1