Do you consider using a nested form to try to delete an image?
Here is a snippet of code from the github site support structure ...
<%= form_for @product, html: { multipart: true } do |f| %> . . . <label> <%= f.check_box :remove_images %> Remove images </label> <% end %>
... which I'm sure you saw. Although, of course, call remove_images! will not work in your case, as this implies a uniform action for all images.
Try the following modification of the above and see if it helps you sort this problem and configure each image separately ...
<%= nested_form_for @product, :html=>{ :multipart => true } do |f| %> . . . <%= f.fields_for :images do |product_form| %> <%= product_form.link_to_remove "Remove this image" %> <% end %> <% end %>
To make this work, be sure to include gem 'nested_form', '~> 0.3.2' in your Gemfile.
Hope this helps you.
Timur Mamedov
source share