Module: DestroyedAt::HasManyAssociation

Defined in:
lib/destroyed_at/has_many_association.rb

Instance Method Summary collapse

Instance Method Details

#delete_records(records, method) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/destroyed_at/has_many_association.rb', line 3

def delete_records(records, method)
  if method == :destroy
    records.each do |r|
      if r.respond_to?(:destroyed_at)
        r.destroy(owner.destroyed_at)
      else
        r.destroy
      end
    end
    update_counter(-records.length) unless inverse_updates_counter_cache?
  else
    super
  end
end