From: Robert Klemme Date: 2007-07-19T22:07:11+09:00 Subject: Re: array sort_by with nil elements 2007/7/19, Stefan Rusterholz : > Robert Klemme wrote: > > This does not work. > > > > irb(main):003:0> [nil].sort_by {|it| it.send(:length) || 0} > > According to him, his problem is not the *element* being nil, but the > *method called upon* returning nil. So yes, this does work for the > problem he describes. > >> problem arise when one criteria like the user.name is nil I stand corrected. Sorry for the noise. Kind regards robert