Forum: Ruby on Rails Collation order in Rails with Postgresql

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
6bdaa71c393fb9501d5f90b27157da8c?d=identicon&s=25 Don Ziesig (donz)
on 2016-03-12 01:50
(Received via mailing list)
Hi All!

I am trying to get a rails postgres table ordered by the exact values of
the ascii characters such that:

<none>
Alpha
Bravo
Charlie
...

Unfortunately, even when I try to escape the < characters and enter them
directly in the Postgresql table, I get:

Alpha
Bravo
*
*
*
Lima
Mike
<none>
November
Oscar

I tried @@@@ in place of <none> and it is positioned as I expect, but
@none@ is handled the same as <none>.

I've searched the web, but there are too many different solutions. It
will take me all day and night to try them out,

Can anyone point me in the right direction?

Thanks,

Don Ziesig
4c6bde00168d595053c09aac7e487f8e?d=identicon&s=25 Colin Law (Guest)
on 2016-03-12 09:41
(Received via mailing list)
On 12 March 2016 at 00:49, Donald Ziesig <donald@ziesig.org> wrote:
>
> <none>
> November
> Oscar
>
> I tried @@@@ in place of <none> and it is positioned as I expect, but @none@
> is handled the same as <none>.
>
> I've searched the web, but there are too many different solutions. It will
> take me all day and night to try them out,
>
> Can anyone point me in the right direction?

possibly
model.all.order(:name)
where name is the column you want to sort on.

Colin
This topic is locked and can not be replied to.