Ruby on Rails Thursday, June 30, 2011

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...@gmail.com> 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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment