lib/paper_trail/record_trail.rb
def record_destroy(recording_order)
      return unless enabled? && !@record.new_record?
      in_after_callback = recording_order == "after"
      event = Events::Destroy.new(@record, in_after_callback)

      # Merge data from `Event` with data from PT-AT. We no longer use
      # `data_for_destroy` but PT-AT still does.
      data = event.data.merge(data_for_destroy)

      version = @record.class.paper_trail.version_class.create(data)
      if version.errors.any?
        log_version_errors(version, :destroy)
      else
        assign_and_reset_version_association(version)
        version
      end
    end
def record_destroy(recording_order)
      return unless enabled? && !@record.new_record?
      in_after_callback = recording_order == "after"
      event = Events::Destroy.new(@record, in_after_callback)

      # Merge data from `Event` with data from PT-AT. We no longer use
      # `data_for_destroy` but PT-AT still does.
      data = event.data.merge(data_for_destroy)

      version = @record.class.paper_trail.version_class.create(data)
      if version.errors.any?
        log_version_errors(version, :destroy)
      else
        assign_and_reset_version_association(version)
        version
      end
    end
`recording_order` is "after" or "before". See ModelConfig#on_destroy.

 @api private
 @return - The created version object, so that plugins can use it, e.g.
 paper_trail-association_tracking