Is there a way with the has_many association (User → Uploads) to work with a nested form? My strong parameters work fine. Users can upload 5 images. I am using accepts_nested_attributes_for in the model and loading works, but there are some gotchas.
But, for example, when I try to edit a user and create only new images using:
(5 - @user.uploads.count).times { @user.uploads.build }
... he builds 5 loadable records inside a nested form, no matter what. The form section is as follows:
<%= f.simple_fields_for :uploads do |i| %>
<hr>
<% user.uploads.each do |upload| %>
<% if upload.image? %>
<%= image_tag(upload.image.url(:medium), class: 'img-rounded').html_safe %>
<br>
<%= i.input :_destroy, as: :boolean,
label: false,
inline_label: 'Remove picture',
wrapper_html: { class: 'text-center' } %>
<% end %>
<% end %>
<%= i.file_field :image %>
<h4>or</h4>
<%= i.input :image_remote_url, label: 'Enter an image URL' %>
<% end %>
ajax Dropzone, URL- Uploads. , . Dropzone , .
- , (/ / ), 5 , . , Dropzone , .