shrinerb / shrine

File Attachment toolkit for Ruby applications

Home Page:https://shrinerb.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Copy example leads to unexpected behaviour

andresespinosapc opened this issue · comments

Brief Description

In the documentation there's an example to copy files now that there's no copy plugin. The problem is that if the file you want to copy is in cache storage, the new file will be on store storage and promotion won't be called. I think the example should be updated or the copy plugin should be back.

Expected behavior

The new file should be on the same storage as the old one. In case that the file is not promoted yet, promotion should be called.

Actual behavior

The new file is always on store storage and promotion is not called.

Simplest self-contained example code to demonstrate issue

attacher.set attacher.upload(other_attacher.file)
attacher.add_derivatives other_attacher.derivatives

other_attacher.file.storage_key # :cache
attacher.file.storage_key # :store

System configuration

Ruby version: 2.7.5

Shrine version: 3.3.0