Module: Paperclip::PermanentRecords::ActiveRecord

Extended by:
ActiveSupport::Concern
Defined in:
lib/paperclip/permanent_records/active_record.rb

Instance Method Summary collapse

Instance Method Details

#destroy(force = nil) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/paperclip/permanent_records/active_record.rb', line 8

def destroy(force = nil)
  if paperclip_attachments? && # only when we have paperclip attachments,
     (!is_permanent? || #  if model does not support "safe deletion"
       ::PermanentRecords.should_force_destroy?(force)) #  or if model supports "safe deletion" but it is forced
    schedule_attachments_for_deletion # => delete the attachments
  end

  super
end