From: Joel Pearson Date: 2013-06-18T00:52:26+09:00 Subject: Re: Compare and sort one array according to another. 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 } -- Posted via http://www.ruby-forum.com/.