Don't update counter cache unless the record is actually saved
#33913

kamipo wants to merge kamipo:counter_cache into rails:master

We do not currently have an analysis of these two commits