So I\'m using Active Storage to upload multiple images attached to a Collection model. Everything works well except whenever I\'m trying to purge/delete a single attachment
The following didn't work for me.
def delete_image_attachment
@image = ActiveStorage::Blob.find_signed(params[:id])
@image.purge
redirect_to collections_url
end
So what i did is found the attachment and purged it. You can do purge_later which is recommended.
def delete_image_attachment
@image = ActiveStorage::Blob.find_signed(params[:id])
@image.attachments.first.purge
redirect_to collections_url
end
This removed both attachment and blob record.