how to sort array if i have array like this in ruby?
example :
my_array = ["12 months", "13 months", nil, nil, "12"]
i want get result like this :
my_array = ["12", "12 months", "13 months", nil, nil]
when i try :
my_array.sort{|x, y| x <=> y}
i get error like this :
ArgumentError Exception: comparison of String with nil failed
how to fix it?
thanks before