Reputation: 5472
I call a controller action "passit" of Rails app A and want to pass an array b to an api update call via an HTTP request using the HTTParty gem patch method:
def passit
b=[[1,2,3],[4,5,6]]
params["a"] = b.to_json
id=5
@options = {query: params}
@response = HTTParty.patch("someapi.com/#{id}", @options)
end
The only way I have found to pass b so far so that a value other than nil gets passed to the API is to stringify it via to_json.
Is the only way to pass a nested array via a patch/put/some kind of update request over http is to "stringify" the parameter via JSON or converting it to a string?
Upvotes: 0
Views: 381