Using Rails 7.0.4.
I have a model with has_one_attached :file
, and when I destroy the model with MyModel#destroy
, the corresponding ActiveStorage::Blob
isn’t deleted.
For it to be deleted, I have added an after_destroy
callback that simply does file.purge_later
. Only then is the blob for that file deleted.
Is that by design?
My understanding was that has_one_attached :file
would take care of doing file.purge_later
automatically upon the model’s deletion without my having to manually call the method.
What am I missing?