search for: all_vot

Displaying 1 result from an estimated 1 matches for "all_vot".

Did you mean: all_of
2009 Nov 09
3
How can I improve a Ruby on Rails code that hast a lot of SQL as strings?
...t; :voteable def self.ranking(user_id) Item.find(:all, # items.* for all the Item attributes, score being the sum of votes, user_vote is the vote of user_id (0 if no vote) and voter_id is just user_id for latter reference. :select => "items.*, IFNULL(sum(all_votes.value), 0) as score, user_votes.value as user_vote, \"#{user_id}\" as voter_id", # The first join gets all the votes for a single item (to be summed latter). # The second join gets the vote for a single user for a single item. :...