Replies: 1 comment
-
I've improved this by adding the storage key, thus bypassing the cache:
But, I'm still wondering if there's a more correct way :) |
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
-
First off, I know this is a niche use case. In my application, the structure of files on disk is important, and controlled by user and model settings. So, I've written my own uploader that overrides
generate_location
to use various things from the record being stored to generate the id. This works fine, and I've been very pleased that Shrine has been able to cope with it!Problem is when the record changes, I need to update the
id
and move the file. At the moment I'm callingattachment_attacher.assign attachment
(sorry for the naming) and saving the record. This works, pretty much.Only problem is, it's leaving the files hanging around in cache, so obviously it's making copies of the files during the process, when really I don't need it to. I think I could perhaps use some overidden
upload_options
to stop that, but my actual question is:Is there a better way of updating the location of a file that I should be using, that I've just not found yet?
Beta Was this translation helpful? Give feedback.
All reactions