I am sorting an Array of items w:
@buddies = @user.buddies.compact.sort_by {|item| item.send @criteria}
i get the results when the item criteria is not nil ( 'display_name',
'email',...)
"display_name"=>"pansart"
"email"=>"p.foe@mysite.com"
but some of the items have "last_name"=>nil
and when I try to sort on it , I get an error
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.<=>
is there anyway to get it sorted ?
additional question (linked to this one obviously...): how to
downcase an item attribute before sorting on it (some display_name
are capitalized other non-capitalized
thanks for your help