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
Erol F. wrote:
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
On Sep 14, 6:23 pm, Matt H. [email protected]
wrote:
What is the accepted procedure for doing this?
Thanks
Matt
What pagination method or plugin are you using?
Erol F. wrote:
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
On Sep 14, 8:32 pm, Matt H. [email protected]
wrote:
Matt
still in trouble 
Thanks
Matt
Give the custom link renderer a try first and render your pagination
links with link_to :method => :post.
On Sep 14, 7:46 pm, Matt H. [email protected]
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?
Hi Matt
On Sep 14, 11:23 am, Matt H. [email protected]
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