CUNY-TAP/fun-with-rspec — pull request #12 by SabCity (2013-11-05 04:47:32+00:00)
Title: Saba's Fun-With_Rspec Assignment

I tried a couple of methods to update the cumulative score. At the end I went with the after_save method. My first attempt used another method that took the link as a parameter and called the vote_up method and also incremented the link's score by 1. The only problem was that I was assuming that the score of a new comment would be 0, rather it was 1. Another attempt i made was to call a new method in the link class that also increments when the vote_up method is called. Well, that seemed to not work properly but I'll look at it again. Finally the best method was the after_save method which added all the link's comments' scores in a loop and updated the link's score. It worked.