作者:北路新华 | 来源:互联网 | 2023-09-04 13:24
Iamusingactiveresourcetogetdatafromanapianddisplayit,Mycontrollermodel.rbhas我正在使用活
I am using active resource to get data from an api and display it,
My controller model.rb has
我正在使用活动资源从api获取数据并显示它,我的控制器model.rb有
class Thr::Vol::Dom '/vv/test/domains/2013-06-25T05:03Z')
x
end
end
When i call this Thr::Vol::Dom.find method it returns the following error:
当我调用此Thr :: Vol :: Dom.find方法时,它返回以下错误:
ArgumentError: expected an attributes Hash,
got ["0.0.0.0", "1.1.1.1", "2.2.2.2", "3.3.3.3", "4.4.4.4"]
The api is expected to feed something like this
预计api会提供类似这样的东西
{"abs.com":["0.0.0.0", "1.1.1.1", "2.2.2.2", "3.3.3.3", "4.4.4.4"]}
for the call i made.
我做的电话。
The API returns the correct hash but i guess active resource is not able to read it properly, it is directly reading the value in the key-value pair of the hash.
API返回正确的哈希值,但我认为活动资源无法正确读取它,它直接读取哈希值的键值对中的值。
I want to fix this "ArgumentError" error , i want to display the contents of the returned hash in the view.
我想解决这个“ArgumentError”错误,我想在视图中显示返回的哈希的内容。
2 个解决方案