My understanding is that the helpers do the "80%" solution for you -- pave the cowpaths -- but expect you to do the edge cases yourself, since you know what you are doing and what you want. Too much "magic" breeds a complacent user that expects everything to just work, all the time, which is unreasonable for the simple fact that software cannot read minds.
Walter
> On Sep 14, 2019, at 7:27 PM, Ariel Juodziukynas <arieljuod@gmail.com> wrote:
>
> 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.
--
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/D24888D7-9D01-4FB3-81C6-7CFB0AFF6800%40wdstudio.com.
No comments:
Post a Comment