mercredi 3 février 2016

Average of a column - Ruby on rails

I am new to rails and I am trying to perform some statistical analysis in a rails application. For this need to find the mean value of the column strokes(data type int).

I have googled the problem but have trouble finding how to start. Can anyone help on where to place this line. Scores.average(:strokes) My table is called scores, the column is called strokes(type int). I am hoping to put the result in my views eventually.

Aucun commentaire:

Enregistrer un commentaire