how to order an array of objects ruby code example Example: ruby sort an object objects.sort_by {|obj| obj.attribute} # OR objects.sort_by(&:attribute)