def <=> anItem
  @date.nil? ? -1 : @date <=> anItem.date
end

You can set the -1, to 0, or 1 depdending where you want the objects
with nil @dates placed.

Farrel

On 3/9/06, larry <ljw1001 / gmail.com> wrote:
> if i make an object sortable using <=> as so:
>
> def <=> anItem
>   @date <=> anItem.date
> end
>
> and date is nil, it fails.  What's the right way to handle nils in this
> scenario?
>
> thanks.
>
>
>