method

inverse_which_updates_counter_cache

rails latest stable - Class: ActiveRecord::Associations::HasManyAssociation

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v4.2.9) is shown here.

inverse_which_updates_counter_cache(reflection = reflection())
private

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.