counter_cache gotcha in activerecord!
If you are using counter_cache, you must watch out for this one. I am not sure if this has been fixed in the recent version, but the version that I am using (1.15.3) has the issue
If you are using counter_cache (such as in acts_as_commentable as described here), you must make sure that after updating the counter (in after_create call in this case), you must not save your commentable object (in this case @song) without reloading it, otherwise the counter will be reset back to the value before the increment.
Took me a while to figure this out and I googled after that and found that other people have faced this issue too. You can read more about the error here
Popularity: 11% [?]
find this blog feedworthy. Click on the number to subscribe!

Thank you for sharing!