我曾要求设立一个铁路客运机服务器,该服务器认为:
POST /api/posts.json HTTP/1.1
Accepts: application/json
X-API-KEY: 7d867d16a5e25337b6d7857965f812bee73b76ac
Content-Length: 288
Content-Type: multipart/form-data; boundary=syoYQUQsGwI2XqShQimFdv2QSe-_GYbjVx40T1kS
Host: 10.0.2.2:3000
Connection: Keep-Alive
User-Agent: Apache-HttpClient/UNAVAILABLE (java 1.4)
--syoYQUQsGwI2XqShQimFdv2QSe-_GYbjVx40T1kS
Content-Disposition: form-data; name="DATA"
Content-Type: application/json; charset=UTF-8
Content-Transfer-Encoding: 8bit
{"tags":["dffdff"],"location_id":3,"post":{"content":"test #dffdff"}}
--syoYQUQsGwI2XqShQimFdv2QSe-_GYbjVx40T1kS--
我如何接触JSON params?
如果我写了字句,以显示我的属性,但所nes的一切都是空洞的(例如,寄生虫[:DATA][后post]或寄生虫[:DATA][:标签]
最新资料:
当我试图做事时
Rails.logger.debug(params[:DATA])
我
{"tags":["dffdff"],"location_id":3,"post":{"content":"test #dffdff"}}
但我却在尝试
Rails.logger.debug(params[:DATA][:post])
我
TypeError (can t convert Symbol into Integer):
app/controllers/api/posts_controller.rb:19:in `[]
app/controllers/api/posts_controller.rb:19:in `create