The update_score method called after a comment is saved in comment.rb would go here.

def update_score
  updated_score = self.comments.sum(:score)
  self.update_attribute(:score, updated_score)
end