Hi,
Am Donnerstag, 09. Jul 2009, 18:46:40 +0900 schrieb Dipti Iyengar:
> I ve to sort risks by "High" "Medium" "Low" "Info" and "Safe"
>
> When I sort in the model it sorts in the alphabetical order which is not
> what i want.
ary.sort_by { |elem|
case elem.risk
when /high/i then 5
when /medium/i then 4
when /low/i then 3
when /info/i then 2
when /safe/i then 1
else 0
end
}
Bertram
--
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de