Ruby on Rails Saturday, September 14, 2019

It adds the "[]" so the parameter is an array (if you don't add that, params[:avatar] will be only one file and not an array). I'm not sure why but the helper does not infer that, you have to be explicit on that.

El vie., 13 sept. 2019 a las 12:34, fugee ohu (<fugee279@gmail.com>) escribió:
I read this example for the form:
<%= p.file_field :avatar, :multiple => true, name:     "post_attachments[avatar][]" %>
Why is the name argument necessary Why can't the controller just get the array from <%= p.file_field :avatar %> ?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/596e6ab8-a045-4bfc-86cb-252bf487f296%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAPS3bcC50WrnXZGt88HwMU_7obfY398X4guJ1uPqYDqAx%3DoCUQ%40mail.gmail.com.

No comments:

Post a Comment