Ruby sort by multiple values?

后端 未结 7 923
南旧
南旧 2020-12-07 22:05

I have an array of hashes:

a=[{ \'foo\'=>0,\'bar\'=>1 },
   { \'foo\'=>0,\'bar\'=>2 },
   ... ]

I want to sort the array first

7条回答
  •  独厮守ぢ
    2020-12-07 22:31

    comparison of Array with Array failed

    This means (at least in my case) that the types of array elements are different. When I made sure all array items are of the same time (Integer, for example), sorting started to work.

提交回复
热议问题