Hey - Need a hand with a straight forward problem... I have names of systems stored in a table and I want the user of the application to be able to have it ascending or descending alphabetically. Is this possible using pagination? Thanks in advance, Gearoid. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
jason.m.stewart-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jul-17 14:24 UTC
Re: Alphabetically ordering
Yes, it''s possible. One way to do it is to make sure you pass your sort column and order to the pagination links, then pass these params back to find in the controller. On Jul 17, 10:10 am, Gearoid Garvey <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hey - > > Need a hand with a straight forward problem... > > I have names of systems stored in a table and I want the user of the > application to be able to have it ascending or descending > alphabetically. Is this possible using pagination? > > Thanks in advance, > Gearoid. > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
jason.m.stewart-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: Thanks for the reply. I''ll give it a shot. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
order = ( params[:order] == "desc" ? "ASC" : "DESC" ) paginate :systems, :order => "name #{order}" Gearoid Garvey wrote:> I have names of systems stored in a table and I want the user of the > application to be able to have it ascending or descending > alphabetically. Is this possible using pagination?-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---