Alphanumeric Order | ActiveRecord Queries

I’m trying to give my iOS app some ordered JSON data and I need to have a custom order(UILocalized​Indexed​Collation order really but this is a topic for another discussion)

One of my test queries looks like this:
y fsts = Festival.all(:order => '0+name ASC, name ASC').map(&:name)

The output I get looks correct:

- AddictedToRadio.com South Beach Tour lll
- AddictedToRadio.com South Beach Tour lll 2
- Electric Beach Festival
- Flashback!
- Winter Music Conference
- WMC 2014 DJ Spin-Off Beatmatching
- WMC 2014 Exhibiting
- 14th Edition RE-UNION

but I’m not 100% sure that it is correct…

The way I want the output data to be ordered is

A
B
C

1
2
3

!

if it makes sense…

Am I on the right track but need to adjust it or this SQL query I have would be sufficient enough?

Google and Stack Overflow aren’t very promising here. You could construct a big case statement for your order clause (and then hopefully be able to reuse it elsewhere).

Here’s one of the more relevant SO posts:

How about using Ruby’s sort method. It accepts an optional block, which allows you to customise how Ruby sorts the results.

I found this on StackOverflow, which may be of help: sorting - How to sort an alphanumeric array in ruby - Stack Overflow