From: masta Blasta Date: 2013-06-18T02:27:19+09:00 Subject: Re: Compare and sort one array according to another. Joel Pearson wrote in post #1112665: > If the items within each array belong to each other, how about a > multidimensional array? > > arr = [ > [ Obj1(prop1, prop2, id), OthrObj1(prop1, prop2, ref_id) ], > [ Obj2(prop1, prop2, id), OthrObj2(prop1, prop2, ref_id) ], > [ Obj3(prop1, prop2, id), OthrObj3(prop1, prop2, ref_id) ] > ] > > > All the sorting is dealt with together then: > > sorted_arr = arr.sort_by { |obj1, obj2| obj1.id } I don't quite understand everything that's happening here. Can you elaborate a bit more on your solution. -- Posted via http://www.ruby-forum.com/.