rails/rails — pull request #10292 by matthewrobertson (2013-04-22 01:19:03+00:00)
Title: Update counter cache when pushing into association

This commit fixes a regression bug (issue #3891) in which counter_cache columns were not being updated correctly when newly created records were being pushed into an assocation. EG:

# this was fine
@post.comment.create!

# this was fine
@comment = Comment.first
@post.comments << @comment

# this would not update counters
@post.comments << Comment.create!