active_record_upsert icon indicating copy to clipboard operation
active_record_upsert copied to clipboard

Does not work with counter_cache

Open hrdwdmrbl opened this issue 2 years ago • 0 comments

Rails version 6

When upserting, association counter caches do not get incremented.

It looks like counter caches do not get incremented with normal callbacks: https://github.com/rails/rails/blob/v6.1.5/activerecord/lib/active_record/counter_cache.rb#L165

I fixed it by incrementing the counters myself but it feels bad :)

hrdwdmrbl avatar Apr 25 '22 21:04 hrdwdmrbl