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 code required I would greatly appreciate it.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Easiest way to do this would be to have a column in the
userstable that stores the total amount of karma points a user has.Set the default to
0. And then in yourkarma_controller, you can put aafter_savecall back that updates the associated user’skarma_countfield 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.