在我的控制器中,我有以下代码......
response = HTTParty.get('https://graph.facebook.com/zuck')
logger.debug(response.body.id)
我得到一个 NoMethodError / 未定义的方法 `id'
如果我做...
logger.debug(response.body)
它按应有的方式输出...
{"id":"4","name":"Mark Zuckerberg","first_name":"Mark","last_name":"Zuckerberg","link":"http:\/\/www.facebook.com\/zuck","username":"zuck","gender":"male","locale":"en_US"}
有人会认为它是response.body.id,但显然这不起作用。提前致谢!