Shouldn't you be counting votes on the comments? The User model acts_as_voter
so, according to the docs on the gem, you can retrieve a list of the items a user has voted on with find_voted_items
, but the Comment model is the one where you can count votes
since that's what the user is voting on.
Edit, given the comments. At it's simplest, you probably need something similar to this:
sum = 0
@user.comments.each do |comment|
sum += comment.votes.count
end
though you can probably make that a bit more eloquent with inject
or even with Activerecord#sum on the votes field with a carefully constructed "where clause".