VoteFu is a voting mixin that allows you to extend your models to vote on one another. Largely based on Cosmin Radoi’s acts_as_voteable plugin, VoteFu adds named_scope support, a set of generators to make using the plugin easier, a :polymorphic association to the voting class (so you can have more than one model type perform votes), and some enhancements for Rails 2.1.
I have simplified the code it requires to cast a vote down from three to one. After setting up your models with the proper mixin functionality, you can cast votes like this:
1 2 3 4 5
voter.vote_for(voteable) # OR voter.vote_against(voteable) # OR voter.vote(voteable, [true | false] )
You can also use the old acts_as_voteable sytnax (which will continue to be supported):
1 2 3 4
vote = Vote.new(:vote => true) m = Model.find(params[:id]) m.votes << vote user.votes << vote
I hope you find the plugin useful. Comments and feedback welcome. If there is enough demand, I’ll open up a lighthouse project to track issues.