sum method

Bolo wrote:

i would like to use sum    def calculate_score      self.score = self.votes.sum(&:score)    end

But this new method was not working

Can u explain me why ?

Try:

self.votes.sum('score')

(For future reference, it is useful if you can post the actual error message that you get, rather than just telling us that it doesn't work.)

Chris