Answer the question
In order to leave comments, you need to log in
Why in Ruby on Rails, when sorting, are numbers below 10 greater than those above 10?
For example, there are records in the database (MySQL), fields (num) with values 7, 31, 54.
So if I sort like this: Table.order('num DESC'), then this option will appear:
7
54
31
And vice versa (without DESC).
And if instead of 7 there will be 10 (and higher), then it will be in the normal order.
Why such a problem?
Answer the question
In order to leave comments, you need to log in
Because the num field seems to be character/text, and not one of the numeric types.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question