title: Rails calculate and display average
body: <p>I'm trying to average scores within a particularly category. I have a table that contains a list of directors, movies, genres, ratings and scores. When the user clicks on a movie I'd like them to be able to see the average score for all other movies in that genre. </p>
  
  <p>I think that I have to use the average method in conjunction with a condition. That said I haven't been able to find any useful documentation online regarding this specific topic. If someone could point me in the direction of a guide or article that explains how to calculate averages with conditions and display them in a view, I would greatly appreciate it!</p>