I''ve got a search action that submits to itself and allows users to search through a list of people by firstname and/or lastname. On submitting the form the action detects POST method, performs the search and renders a results template. My question is how can I integrate pagination with the search results? If I use pagination like normal it will revert to GET method and thus display the search form again. What is the accepted procedure for doing this? Thanks Matt --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Sep 14, 6:23 pm, Matt Harrison <iwasinnamuk...-ja4MoDZtUtVl57MIdRCFDg@public.gmane.org> wrote:> I''ve got a search action that submits to itself and allows users to > search through a list of people by firstname and/or lastname. > > On submitting the form the action detects POST method, performs the > search and renders a results template. > > My question is how can I integrate pagination with the search results? > > If I use pagination like normal it will revert to GET method and thus > display the search form again. > > What is the accepted procedure for doing this? > > Thanks > > MattWhat pagination method or plugin are you using? --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Erol Fornoles wrote:> On Sep 14, 6:23 pm, Matt Harrison <iwasinnamuk...-ja4MoDZtUtVl57MIdRCFDg@public.gmane.org> > wrote: >> I''ve got a search action that submits to itself and allows users to >> search through a list of people by firstname and/or lastname. >> >> On submitting the form the action detects POST method, performs the >> search and renders a results template. >> >> My question is how can I integrate pagination with the search results? >> >> If I use pagination like normal it will revert to GET method and thus >> display the search form again. >> >> What is the accepted procedure for doing this? >> >> Thanks >> >> Matt > > What pagination method or plugin are you using?I''m currently using will_paginate, which works beautifully for the main contact list. I''m just not sure how to get it integrate with a POST search. Thanks Matt --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Sep 14, 7:46 pm, Matt Harrison <iwasinnamuk...-ja4MoDZtUtVl57MIdRCFDg@public.gmane.org> wrote:> I''m currently using will_paginate, which works beautifully for the main > contact list. > > I''m just not sure how to get it integrate with a POST search. > > Thanks > > MattCorrect me if I''m wrong, but you want the pagination link to be rendered as POST methods, right? Have you tried creating your own custom link render? --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Erol Fornoles wrote:> On Sep 14, 7:46 pm, Matt Harrison <iwasinnamuk...-ja4MoDZtUtVl57MIdRCFDg@public.gmane.org> > wrote: >> I''m currently using will_paginate, which works beautifully for the main >> contact list. >> >> I''m just not sure how to get it integrate with a POST search. >> >> Thanks >> >> Matt > > Correct me if I''m wrong, but you want the pagination link to be > rendered as POST methods, right? Have you tried creating your own > custom link render?I haven''t tried doing it myself yet, I just thought there would be a problem as each click of a standard page link would be a GET request and that would cause the action to display the form instead of the results. I think I have an idea how to get round it so I''ll post again if I''m still in trouble :) Thanks Matt --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Sep 14, 8:32 pm, Matt Harrison <iwasinnamuk...-ja4MoDZtUtVl57MIdRCFDg@public.gmane.org> wrote:> Erol Fornoles wrote: > > On Sep 14, 7:46 pm, Matt Harrison <iwasinnamuk...-ja4MoDZtUtVl57MIdRCFDg@public.gmane.org> > > wrote: > >> I''m currently using will_paginate, which works beautifully for the main > >> contact list. > > >> I''m just not sure how to get it integrate with a POST search. > > >> Thanks > > >> Matt > > > Correct me if I''m wrong, but you want the pagination link to be > > rendered as POST methods, right? Have you tried creating your own > > custom link render? > > I haven''t tried doing it myself yet, I just thought there would be a > problem as each click of a standard page link would be a GET request and > that would cause the action to display the form instead of the results. > > I think I have an idea how to get round it so I''ll post again if I''m > still in trouble :) > > Thanks > > MattGive the custom link renderer a try first and render your pagination links with link_to :method => :post. --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Matt On Sep 14, 11:23 am, Matt Harrison <iwasinnamuk...-ja4MoDZtUtVl57MIdRCFDg@public.gmane.org> wrote:> I''ve got a search action that submits to itself and allows users to > search through a list of people by firstname and/or lastname. > > On submitting the form the action detects POST method, performs the > search and renders a results template. > > My question is how can I integrate pagination with the search results?Why don''t you use :method => :get on your form instead which will put your search criteria into the query string and then the subsequent get requests from the will_paginate links will just append the page to the querystring and all work fine. From a REST point of view the search action would use the GET verb anyway as it is retrieving a list. Graham --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---