class ActiveRecord::Associations::HasManyAssociation

def delete_records(records, method)

Deletes the records according to the :dependent option.
def delete_records(records, method)
  if method == :destroy
    records.each(&:destroy!)
    update_counter(-records.length) unless reflection.inverse_updates_counter_cache?
  else
    scope = self.scope.where(reflection.klass.primary_key => records)
    update_counter(-delete_count(method, scope))
  end
end