active_record_upsert
active_record_upsert copied to clipboard
Does not work with counter_cache
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 :)