Is it possible to sort users by how much karma they have from getting votes on their voteable objects in the thumbs_up Rails gem? If anyone could detail the scope c开发者_运维百科ode required I would greatly appreciate it.
Easiest way to do this would be to have a column in the users
table that stores the total amount of karma points a user has.
Set the default to 0
. And then in your karma_controller
, you can put a after_save
call back that updates the associated user's karma_count
field every time that user is rated.
Then all you need to do is User.order("karma_count asc")
That should be enough to point you in the right direction.
精彩评论