我将使用旧的城市目录作为参考,并通过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) }
我是一个初学者,所以也许我做错了。