Will_paginate and pagination in general

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

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…

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs