| Module | ActsAsTrashable::InstanceMethods |
| In: |
lib/acts_as_trashable.rb
|
# File lib/acts_as_trashable.rb, line 36
36: def destroy_with_trash
37: return destroy_without_trash if @acts_as_trashable_disabled
38: TrashRecord.transaction do
39: trash = TrashRecord.new(self)
40: trash.save!
41: return destroy_without_trash
42: end
43: end
Call this method to temporarily disable the trash feature within a block.
# File lib/acts_as_trashable.rb, line 46
46: def disable_trash
47: save_val = @acts_as_trashable_disabled
48: begin
49: @acts_as_trashable_disabled = true
50: yield if block_given?
51: ensure
52: @acts_as_trashable_disabled = save_val
53: end
54: end