Ruby on Rails Wednesday, December 5, 2012

Hey all,
          I am trying to list students in alphabetical order starting from a to z but using search logic I unable to do that. can any one help me out.
          These lines are in controller

           @search = Student.search(params[:search])
          @students+=@search.all

View
    <% @students= @students.sort_by(&:last_name) %>
 i am able to sort it but not in alphabetical order. Help me


Cheers,
Kp

--
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.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/Rj9Qh0KXBWkJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment