I would first like to thank you for all the work done on Shrine ! Especially the refactor done with Shrine 3.
Having said that, I’m seeking your help :
Let’s say that I have 2 models : ModelA and ModelB. Each ones have a field/Shrine::Attachment named “file”.
Let’s also say that I have a Shrine::Storage::Filesystem as :cache, and a Shrine::Storage::S3 as :store .
In that situation, I would like to copy a file attached (and uploaded to S3) on a ModelA instance, to a ModelB instance, with both file being “independant” (destroying the instance of ModelA will only delete its file, not the one on the ModelB instance). Doing something like :
instanceA = ModelA.first instanceB = ModelB.first instanceB.file = instanceA.file instanceB.save
Now, I know that Shrine::Storage::S3 can handle S3 copy directly (and not having to download and reupload) when Shrine::Storage::S3.upload is called on promotion.
The problem is that when I assign something to the Shrine::Attacher, there’s an “upload” to the cache storage, and this will download the file from S3. On promotion, the file is then upload again to S3.
So my question is : how can I assign another’s Shrine::UploadedFile (stored in S3) to an other Shrine::Attacher, and use the S3 copy, and NOT the download & upload logic ?
One way would be to force S3 as the cache storage (I think? I’m not sure), but I don’t find that solution acceptable in my case.
Does anybody have an idea?