How to POST arrays as a parameter using HTTP request in rails?

Hi guys,

I am trying to send arrays using POST in rails 4.0. But instead of sending the whole array, it seems to send only the last value in the array.

I used the following code snippet:

uri = URI.parse(‘http://localhost:3000/abc’)

http =, uri.port)
request =
response = http.request(request)

I also tried using ‘httpparty’ gem for the same, but it is also showing an error.

Can anyone point out as to what I am doing wrong? What is the best way of sending arrays using POST in Rails?



Is the receiving end a rails app? if so then the parameter name must end in [] for rails to treat it as an array (for example “names[]” will result in params[:names] being an array)


Yes, the receiving end is a rails app. It worked. Thanks a lot.