Reputation: 17498
My form has a multiple select element like this:
<select id="startup_markets" multiple="multiple" name="startup[markets][]" style="width:100%">
<option value="fashion">Fashion</option>
<option value="startups">Startups</option>
<option value="apps">Apps</option>
<option value="social-media">social media</option>
<option value="email-marketing">Email Marketing</option>
</select>
After submitting the post body looks like this:
------WebKitFormBoundaryiICoZLa9BoF6eFMx Content-Disposition: form-data; name="startup[markets][]"
fashion ------WebKitFormBoundaryiICoZLa9BoF6eFMx Content-Disposition: form-data; name="startup[markets][]"
startups
But on rails I get the markets as an array of array:
(byebug) params["startup"]["markets"]
[["fashion", "startups"]]
Wasn't it supposed to be just ["fashion", "startups"]
? I'm probably doing something silly here but can't figure out what's wrong. Thanks for the help.
Upvotes: 0
Views: 466