In my view I have this:
<% @item.images.each do |image| %>
<%= image_tag image.images_url(:large) %>
<% end %>
If I have one image uploaded, it returns the error undefined method 'each' for #<ImagesUploader::UploadedFile:0x00007f8a0f0c0760>
, but if I upload more than one, this view works fine. Alternately, <%= image_tag @item.images_url(:large) %>
without the enclosing block works just fine.
I did not have this problem prior to switching from ActiveStorage to Shrine.
How can I write my view so that it shows all uploaded images, whether it's one or many?
You can do something like following
This will always return the array, check following examples.