Re: Sorting Text in ROR

pepe
Thu, 30 Jun 2011 15:47:30 -0000

If I were you I would add a new column PLAIN_NAME or similar and I
would strip everything out everything you don''t want in the name and
then sort by it. I think it would remove the complexity. You can
populate the new column with a before_save callback.

On Jun 10, 10:59 am, Runa
<roonadan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:
> While sorting /ordering text it considers space first, then
''.'' then
> characters
>
>  e.g.   @user = User.find(:all,:order=>''name'')
>
> it outputs
>
> A Sharma
> A. Bansal ---------------with dot
> Aarti Dev
>
> Is there any way to sort, so that i get the output as
> Aarti Dev
> A. Bansal
> A Sharma

--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.