# Will\_paginate and pagination in general

**URL:** <https://www.ruby-forum.com/t/will-paginate-and-pagination-in-general/127122>\
**Category:** Rails\
**Created:** [January 25, 2008, 4:28am UTC](https://www.ruby-forum.com/t/will-paginate-and-pagination-in-general/127122 "2008-01-25T04:28:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [January 25, 2008, 4:28am UTC](https://www.ruby-forum.com/t/will-paginate-and-pagination-in-general/127122/1 "2008-01-25T04:28:33Z")

</div>

I dont know what I am doing wrong. I was trying to use the pagination  
that is built into rails, wouldnt work, tried will\_paginate, still wont  
work. I have a drop down list where the user will choose one of the  
countrys in the list. I use the following to do the search…

@country = params[:country] \<-- option from the drop down list

@searches = Searches.paginate\_by\_country @country, :page =\>  
params[:page], :per\_page =\> 10

In the view everything works great and it shows links for the different  
pages that the results are split up into. I click on one and the page  
is blank.

Is it a problem with passing the param from the drop down list to the  
next page?

Thanks in advance,

Chris

---

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [January 25, 2008, 6:01am UTC](https://www.ruby-forum.com/t/will-paginate-and-pagination-in-general/127122/2 "2008-01-25T06:01:31Z")

</div>

The problem is when u using will\_paginate or any other thing for  
pagination this will happen unless u pass the search term as params with  
the url…

try to pass the search term using params in view and in controller try  
to use that and find from Db…

What actually happens behind the process is…

For the first time that Searches.paginate\_by\_country will fetch all the  
records from Db and displays only the number of records specied in page  
size…

Next time on clicking the next or page links…

The same method doing the search will be called and the next set of  
records will be displayed, params[:page] is the page number  
parameter(this species which set, either first set or next set or the  
third one) like ?page=2 which is appended to the url…  
try to pass yr search term also with this…
