这是我的api请求机构。
{
"product": {
"name": "LG TV",
"subcategory_id": 1,
"price": 15.40,
"quantity": 50,
"company_name": "LG",
"product_images_attributes": {
"0": {
"image": #<ActionDispatch::Http::UploadedFile:0x007ff480760350 @tempfile=#<Tempfile:/tmp/RackMultipart20180414-5482-q352rm.pdf>, @original_filename="Bill.pdf", @content_type="application/pdf", @headers="Content-Disposition: form-data; name=\"product[product_images_attributes][0][image]\"; filename=\"Bill.pdf\"\r\nContent-Type: application/pdf\r\n">
}
}
}
我正在设置内容类型:&#39; multipart / form-data&#39;当我尝试发送表格然后我收到了json params.Here是我收到的参数。
<ActionController::Parameters {"{\"product\": {\"name\": \"LG TV\",\"subcategory_id\": 1,\"price\": 15.40,\"quantity\": 50,\"company_name\": \"LG\",\"product_images_attributes\": {\"0\": {\"image\": #<ActionDispatch::Http::UploadedFile:0x007ff480760350 @tempfile"=>"#<Tempfile:/tmp/RackMultipart20180414-5482-q352rm.pdf>, @original_filename=\"Bill.pdf\", @content_type=\"application/pdf\", @headers=\"Content-Disposition: form-data; name=\\\"product[product_images_attributes][0][image]\\\"; filename=\\\"Bill.pdf\\\"\\r\\nContent-Type: application/pdf\\r\\n\">}}}}", "auth_token"=>"b864eb626eb05da3d688", "format"=>:json, "controller"=>"api/v1/products", "action"=>"create"} permitted: false>
如何解析params并获取产品json?