CUNY-TAP/fun-with-rspec — pull request #5 by msquitieri (2013-11-04 21:21:52+00:00)
Title: Assignment Completed!

Hello,

Here is my implementation for the assignment. I also had issues with implementing the cumulative_score functionality, but it didn't have to do with using the after_save callback. If I created a link, and then appended comments to it and saved it, the cumulative_score would not be correct, even if I did reload the object. It seems to work once you save the comment you created (even though you used FactoryGirl.create). It turned into just a frustrating trial and error of seeing what had to be saved or reloaded again. Regardless, the implementation committed here passes all tests.

P.S. I even put up a question on stack overflow on this implementation (however, I made cumulative_score a separate instance variable and not the score field in the database). You can find the question here: http://stackoverflow.com/questions/19758978/instance-variable-of-activerecord-object-not-changing-with-method-call

Thanks, and see everyone on Friday!