Is there a replacement for the delete_raw plugin? #679
Unanswered
ndbroadbent
asked this question in
Q&A
Replies: 1 comment
-
Hi, you can override this globally in the initializer: class Shrine
def upload(io, delete: true, **)
super(io, delete: delete, **)
end
end Or per uploader: class ImageUploader < Shrine
def upload(io, delete: true, **)
super(io, delete: delete, **)
end
end I do think it should the responsibility of the caller to clean up temporary files after upload, the ones not created within Shrine (such as derivatives/veresions), but I think there is no harm in overriding Shrine like that. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
We are upgrading Shrine and see a deprecation warning for the delete_raw plugin. The plugin code looks fairly simple - it just sets the
:delete
argument to true instead of the default false value. And this just triggers one line of code to unlink the file after the upload is finished. But if we remove this plugin then we have to manually passdelete: true
whenever we call#upload
. We have some uploaders that don't generate any versions or derivatives, and we just want to delete the temporary file automatically after it's uploaded.I still want to set this as the default behavior across all uploaders in our application, because I think it's a very sensible default. Is there any other way to configure this for Shrine globally, or per uploader?
EDIT: Do you suggest handling this logic ourselves now? Maybe we should just be tidying up after ourselves in our own code using
File.unlink
,FileUtils.rm_rf
, etc.Beta Was this translation helpful? Give feedback.
All reactions