Override update_counters from counter_cache: true
https://www.lukeko.com/11/override-update_counters-from-counter_cache-true 0class Post < ApplicationRecord
belongs_to :author, counter_cache: true
end
class Author < ApplicationRecord
has_many :posts
def self.update_counters(id, counters)
Author.find(id).do_something!
super(id, counters) # continue on with the normal update_counters flow.
end
end