[Rails] Re: Sorting Text in ROR

2011-06-30 Thread pepe
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 wrote: > While so

Re: [Rails] Re: Sorting Text in ROR

2011-06-10 Thread Colin Law
On 11 June 2011 07:10, Runa wrote: > Thanks Walter and Kendall. > > But ouput which I get using sort mentioned  is as follows > >>> a = [ "A Sharma", "A. Zah", "Aarti Jain", "A. Bansal", "Bindu Lakra" ] > => ["A Sharma", "A. Zah", "Aarti Jain", "A. Bansal", "Bindu Lakra"] >>> a.sort {|x,y| y <=> x

[Rails] Re: Sorting Text in ROR

2011-06-10 Thread Runa
Thanks Walter and Kendall. But ouput which I get using sort mentioned is as follows >> a = [ "A Sharma", "A. Zah", "Aarti Jain", "A. Bansal", "Bindu Lakra" ] => ["A Sharma", "A. Zah", "Aarti Jain", "A. Bansal", "Bindu Lakra"] >> a.sort {|x,y| y <=> x} => ["Bindu Lakra", "Aarti Jain", "A. Zah", "