Reputation: 95
Still a rails newbie, trying to order the following list by the sum of votes_for+votes_against
on subitems, with thumbs_up the votes live in another table though
@subitems = @items.subitems
Upvotes: 1
Views: 205
Reputation: 1049
You should use:
@items = Item.plusminus_tally({:order => "vote_count ASC"})
I included the order override in there, in case you wanted to change it from the default of descending order. This is for Rails 3.
A subitem should have it's own:
acts_as_voteable
in its model.
Upvotes: 1