On Feb 26, 7:11 am, LRayZor <[email protected]> wrote:
>
> Score table consists of 2 fields 'value:integer' and 'hate:boolean'
>
> What I want to do is replace the 'scores.count' column which merely
> counts the number of ratings with the average of all the scores given
> to the game.
>
> Any idea how I go about this?

on your game model:

def average_score
  scores.average(:value)
end

then just change scores.count to average_score

-david


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to