This is my api request body.
{
"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">
}
}
}
I am setting content-type: 'multipart/form-data' when i try to send form then i am receiving json params.Here the params which i am receiving.
<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>
How can I parse params and get product json?