If I had to send a bunch of post parameters along an HTTP request, all with the same name, how do I construct the data
object to post?
Picture a form with some check boxes, they all have the same name
attribute but with different values (if they're checked):
<input name="color" value="red"/>
<input name="color" value="green"/>
<input name="color" value="blue"/>
I want to construct this in ruby (but it needs to be created dynamically depending on what was selected on the form):
data = {
"color" => "red",
"color" => "green",
"color" => "blue"
}
And then send the data to some URL:
Net::HTTP.post_form(url, data)
I cannot control the receiving end, so I have to send the parameters as it expects to receive them. How?