如何在httparty中发送作为url一部分的参数

时间:2018-05-10 10:54:36

标签: ruby-on-rails ruby rails-api httparty

我想向网址发出请求:

java.text.ParseException: Unparseable date: "2018-01-30T23:59:59.000"

当我跑步时:

url = http://localhost:3000/api/v1/new_car/car_makes/:make/detail

我收到:

query[:make] = "honda"
HTTParty.get(url, :query => query, :headers => @headers)

并收到参数值:

params[:make] #=> nil

我该如何解决?

1 个答案:

答案 0 :(得分:0)

你可以做到

    params = params.with_indifferent_access

您将能够以两种方式访问​​

    params["make"] and params[:make]