Can anyone tell me when and why we use multipart: true in rails.?
There are two attributes in form
color:string
name : string
i want to confirm that there is no need of multipart: true, right ?
multipart: true
is used, when you have file upload in your form.
Check the documentation
on file uploading.
You can go with either form_tag
with explicit multipart: true
or with simply form_for
.
<%= form_tag({action: :upload}, multipart: true) do %>
<%= file_field_tag 'picture' %>
<% end %>
<%= form_for @person do |f| %>
<%= f.file_field :picture %>
<% end %>
In your case you don't need multipart: true
, since you only have attributes color
and name
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With