How to implement soft delete?

We are using acts_as_paranoid.
It does the following thing.
The first time destroy is called, it sets deleted_at. The second time it is called, it deletes the active record.

I am thinking about how to integrate this behavior with Shrine. Delete the S3 objects after the second, real destroy. Has anyone tried such a thing?


Update 1

I was looking at
but it says:


But I can not see what Attacher is. I have only the ImageUploader::Attachment in my record.

I do have

class ImageUploader < Shrine
class ContentPicture < ApplicationRecord
  include ImageUploader::Attachment(:image) # adds an `image` virtual attribute 

But the method activerecord_before_save is never called

class ImageUploader < Shrine

  def activerecord_before_save
    # never gets called


I found out how. You should do

class ImageUplaoder  < Shrine

  class Attacher < Shrine::Attacher
     def activerecord_before_destroy

I know. It kind of feels strange. A class in a class when the instance of the inner gets associated with the instance of the outer automatically.

I also found out, because of a different post, that there is

Now it is not clear from the documentation whether it will delete the files when the record is fully deleted. I will try it out.