Displaying 1 result from an estimated 1 matches for "calculate_scor".
Did you mean:
  calculate_score
  
2006 Oct 18
1
sum method
Hello
in my Faq model i added a method
   def calculate_score
     score_faq = 0
     self.votes.each do |t|
       score_faq += t.score
     end
    self.score= score_faq
   end
this method working well but 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...