class ActiveRecord::Associations::BelongsToAssociation

def update_counters(by)

def update_counters(by)
  if require_counter_update? && foreign_key_present?
    if target && !stale_target?
      target.increment!(reflection.counter_cache_column, by, touch: reflection.options[:touch])
    else
      update_counters_via_scope(klass, owner._read_attribute(reflection.foreign_key), by)
    end
  end
end