From: "Florian Groß" Date: 2007-03-26T21:55:26+09:00 Subject: Re: sorting an array basedon two attributes of objects On 26 Mrz., 14:48, senthil wrote: > I want to sort the objects of array based on two attributes.I want > sort an employee class based on his salary and name , so that if two > person has same salary it should be sorted with name. Try this: employees.sort_by { |employee| [employee.salary, employee.name] } Kind regards, Florian Gross