0
我找不到解決方案,所以我決定在這裏問。 我在此陣列(施工如果需要也可以改變):Rabl和陣列陣列
[[{:time=>2014, :amount=>148.24018480434023}, {:time=>2015, :amount=>152.5625744766238}], [{:time=>2014, :amount=>151.06717076828187}, {:time=>2015, :amount=>158.43869963240266}]]
在Rabl的模板我有:
collection @array, object_root: false
node :collection do |s|
s
end
,並且響應:
[{"collection": [{"time": 2014,"amount": 148.24018480434023},{"time": 2015,"amount": 152.5625744766238}]},{"collection": [{"time": 2014,"amount": 151.06717076828187},{"time": 2015,"amount": 158.43869963240266}]}]
然而我想擺脫「收集」節點,並得到確切的迴應:
[ [{ time: 2014, amount: 138.92 }, { time: 2015, amount: 142.98 }], [{ time: 2014, amount: 141.57 }, { time: 2015, amount: 148.48 }] ]