I have a counter_cache
column in my model. I use acts_as_paranoid
for this model (Paranoia gem). How to update a counter cache column for an associated record when I restore a record?
You may use a before_restore
callback. Place .increment_counter
method for an associated record inside this before_restore
callback.
reset_counters
method or += 1
won't work.