module Sequel::Plugins::Paranoid::SoftDeleteOnDestroy::InstanceMethods

Public Instance Methods

_destroy_delete() click to toggle source

Overwrite the “_destroy_delete” method which is used by sequel to delete an object. This makes sure, we run all the hook correctly and in a transaction.

# File lib/sequel/plugins/paranoid.rb, line 127
def _destroy_delete
  # _destroy_delete does not take arguments.
  destroy_options = Thread.current["_paranoid_destroy_args_#{self.object_id}"].first
  Thread.current["_paranoid_destroy_args_#{self.object_id}"] = nil

  send(self.class.sequel_paranoid_options[:delete_method_name], destroy_options)
end
destroy(*args) click to toggle source
Calls superclass method
# File lib/sequel/plugins/paranoid.rb, line 113
def destroy(*args)
  # Save the variables threadsafe (because the locks have not been
  # initialized by sequel yet).
  Thread.current["_paranoid_destroy_args_#{self.object_id}"] = args

  super(*args)
end