重用ActiveStorage文件

我将使用旧的城市目录作为参考,并通过activeStorage上传文档的图像。但是我可能多次使用同一页面作为参考,并希望避免同一图像有多个副本。能做到吗?

_forms.html.erb与new.html.erb相关:

<div class="row">
  <div>
    <%= form.label :documents,"Select source document(s) or image that support this information." %>
    <%= form.file_field  :documents,multiple: true %>
  </div>
  <div class="form-inputs well well-sm">
    <%= form.label :caption,"Captions for document being uploaded:" %>
    <%= form.text_area :caption %>
  </div>
</div>

型号:

has_many_attached :documents # activeStorage
scope :with_eager_loaded_documents,-> { eager_load(documents_attachments: :blob) }

我是一个初学者,所以也许我做错了。

lucas0421 回答:重用ActiveStorage文件

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2989294.html

大家都在问