How to sort an array of hashes in ruby
Use the bang to modify in place the array:
array_of_hashes.sort_by!(&:zip)
Or re-assign it:
array_of_hashes = array_of_hashes.sort_by(&:zip)
Note that sort_by method will sort by ascending order.
If you need to sort with descending order you could do something like this:
array_of_hashes.sort_by!(&:zip).reverse!
or
array_of_hashes = array_of_hashes.sort_by(&:zip).reverse