Find and order

I have a find that look likes this:

@values = UdidValue.find(:all,
:conditions => [‘udid_id = ?’, x.id], :order => ‘value ASC’)

The problem is that ‘value’ could be a street address, for example,
numbers. So, when I do the :order if they are strings the get order
wonderfully, but in one case I have values that are numbers, for
example, 234, 233, 219, 25, 199, which get order as 199, 25, 219, 233,
234. Which is not what I want. I would like to order as 25, 199, 219,
233, 234.

Is there a way to get the order to order properly regardless if it is a
number of string? Thanks,

-S

233, 234.

Is there a way to get the order to order properly regardless if it
is a
number of string? Thanks,

Google for “natural sort” for your particular database.

If mysql, maybe…
http://blog.feedmarker.com/2006/02/01/how-to-do-natural-alpha-numeric-sort-in-mysql/