如何使用savon嵌套数组属性!(How do I use savon nested array attributes! hash?)
我正在使用Ruby Savon,我必须创建一个包含其中包含属性的数组的请求。 我的问题是我如何在每个子数组中添加一个属性。
<persons> <person id=1> <firstName>JOHN</firstName> </person> <person id=2> <firstName>ANNIE</firstName> </person> </persons>我尝试将属性放到数组中也没有成功。
{ persons: { person: [ { firstName: "JOHN"}, { firstName: "ANNIE" } ], :attributes! => { :person=> [ { id: "1" }, { id: "2" } ] } } }.to_soap_xmlI am using Ruby Savon and i have to create a request that contains an array that has attributes in it. My problem is how do i add an attribute in each of the child array.
<persons> <person id=1> <firstName>JOHN</firstName> </person> <person id=2> <firstName>ANNIE</firstName> </person> </persons>I tried putting the attributes to an array without success as well.
{ persons: { person: [ { firstName: "JOHN"}, { firstName: "ANNIE" } ], :attributes! => { :person=> [ { id: "1" }, { id: "2" } ] } } }.to_soap_xml最满意答案
{ persons: { person: [ { firstName: "JOHN", :@id => 1}, { firstName: "ANNIE", :@id => 2 } ] } } { persons: { person: [ { firstName: "JOHN", :@id => 1}, { firstName: "ANNIE", :@id => 2 } ] } }更多推荐
发布评论