I have an array of array of hash. For example,
arr =[[{:id=>61,:price=>20}, {:id=>61, :price=>23}, {:id=>61, :price=>60}],
[{:id=>65, :price=>20}, {:id=>65, :price=>23}, {:id=>65, :price=>60}],
[{:id=>69, :price=>20}, {:id=>69, :price=>33}, {:id=>69, :price=>80}]]
order_arr = [65,69,61]
How can I reorder the above array in a given order(based on 'order_arr') of key :id .
So, the result should be as below:
[[{:id=> 65, :price=>20}, {:id=>65, :price=>23}, {:id=>65, :price=>60}],
[{:id=>69, :price=>20}, {:id=>69, :price=>33}, {:id=>69, :price=>80}],
[{:id=>61,:price=>20}, {:id=>61, :price=>23}, {:id=>61, :price=>60}]]
Please help