bouchard/thumbs_up — pull request #65 by pboling (2013-02-14 20:57:20+00:00)
Title: Allow self love

Where is the love?

I have Users that need to vote on other Users.

````
class User
acts_as_voter # People vote ...
acts_as_voteable # On other people
end
````

This adds two has_many relationships to the class with the second obscuring the first:

````
has_many :votes, :as => :voter, :dependent => :destroy
has_many :votes, :as => :voteable, :dependent => :destroy
````

With this pull request the relationship name is configurable, though by default stays as :votes for both, so it is fully backward compatible. Now you can do the following in an initializer:

````
ThumbsUp.configure do |config|
config.voteable_relationship_name = :votes_by
config.voter_relationship_name = :votes_on
end
````

Now on any given user:
````
u = User.first
u.votes_on # => the votes that have been cast on this user
u.votes_by # => the votes that have been cast by this user
````

Thanks for the great voting tool!