Doing multiple uploads with Active Storage
Hi there,
I am following this tutorial to do multiple file uploads with DropboxJS but I don't know how to get multiple images belonging to a model to show in the 'show' page. Only one image shows when I upload multiple images, despite doing a .each
in the@post.feature_image
array.
Tutorial here:
https://web.archive.org/web/20191223022642/https://web-crunch.com/rails-drag-drop-active-storage-stimulus-dropzone/
Example Repo: https://github.com/justalever/drag_and_drop_active_storage
Changes I have made to get it working:
_form.html.erb
data-dropzone-max-files="10"
posts/show.html.erb
<%= link_to @post do %>
<% @post.feature_image.each do |image| %>
<%= image_tag image %>
<% end %>
<% end %>
models/post.rb
class Post < ApplicationRecord
belongs_to :user
has_many_attached :feature_image
end