acts_as_voteable allows you to mix voting into your models:
Post < ActiveRecord::Base
acts_as_voteable
end
User < ActiveRecord::Base
acts_as_voter
end
#simple vote
user.vote_up(post)
user.vote_down(post)
#vote about something:
user.vote_up(post, :about => 'spam')
#check for a vote
user.voted_up?(post)
#count votes:
user.votes.count
user.up_votes.count
user.down_votes.count
#points (up - down)
user.points
#coming soon
user.points(:about => 'spam')
#sorting - works just like find from AR with a few changes
Post.find_top(:all, :since => 1.day.ago, :about => 'spam')
There are also generators for tests so you can verify that you installed correctly:
script/generate acts_as_voteable_test post
installation:
script/install plugin http://richcollins.net/svn/acts_as_voteable/
Send feedback to richcollins@gmail.com
Enjoy!
Ohloh computes statistics on FOSS projects by examining source code and commit history in source code management systems. This project has no code locations, and so Ohloh cannot perform this analysis
Is this project's source code hosted in a publicly available repository? Do you know the URL? If you do, click the button below and tell us so that Ohloh can generate statistics! It's fast and easy - try it and see!
Copyright
©
2013
Black Duck Software, Inc.
and its contributors, Some Rights Reserved. Unless otherwise marked, this work is licensed under a
Creative Commons Attribution 3.0 Unported License
. Ohloh
®
and the Ohloh logo are trademarks of
Black Duck Software, Inc.
in the United States and/or other jurisdictions. All other trademarks are the property of their respective holders.