我正在試圖使頁面中的內容是來自兩個數組的數據。 我有兩個列表(陣列)與哈希: 如何有效地從json列表中接收紅寶石哈希
arr1 = [
{ "device"=>100, "phone"=>"12345" },
...,
{ "device"=>102, "phone"=>"12346" }
]
arr2 = [
{ "device"=>100, "type"=>"mobile", "name"=>"nokia" },
...,
{ "device"=>102, "type"=>"VIOP", "name"=>"smth" }
]
How can I join hashes from arr1 and arr2 by "device" to get a result array:
result = [ { "device"=>100, "phone"=>"12345", "type"=>"mobile", "name"=>"nokia" }, ..., { "device"=>102, "phone"=>"12346", "type"=>"VIOP", "name"=>"smth" } ]
頁,其中包括表結果數組,負荷非常緩慢,我需要找到產生result_array的最快方式。
請幫助我。
斯特凡,非常感謝 – bmalets