From: dblack@... Date: 2007-01-09T23:40:22+09:00 Subject: Re: sortung a structured array on more than one criteria Hi -- On Tue, 9 Jan 2007, Josselin wrote: > I can sort an array like that : > > results = rs.sort_by{|p| p.km} > > but I tried to add a scrond sorting criteria like that : > > results = rs.sort_by{|p| p.km, p.updated_at } > > and I got obviously an error ... parse error, unexpected '}', expecting > tCOLON2 or '[' or '.' > > canot find the correct writing.. Try this: results = rs.sort_by {|p| [p.km, p.updated_at] } David -- Q. What is THE Ruby book for Rails developers? A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black) (See what readers are saying! http://www.rubypal.com/r4rrevs.pdf) Q. Where can I get Ruby/Rails on-site training, consulting, coaching? A. Ruby Power and Light, LLC (http://www.rubypal.com)