Flowdock
method

inverse_which_updates_counter_cache

Importance_1
v5.2.3 - Show latest stable - 0 notes - Class: AbstractReflection
inverse_which_updates_counter_cache() public

This shit is nasty. We need to avoid the following situation:

* An associated record is deleted via record.destroy
* Hence the callbacks run, and they find a belongs_to on the record with a
  :counter_cache options which points back at our owner. So they update the
  counter cache.
* In which case, we must make sure to *not* update the counter cache, or else
  it will be decremented twice.

Hence this method.

Show source
Register or log in to add new notes.