Re: Pagination + Search Parameters. How?

Alain Ravet
Wed, 09 May 2007 23:29:37 -0000

Felipe,

   > I''m having trouble to pass filter parameters on my search form
while
   > using paginator, the issue is that when I click in the "Next
Page"
   > link, the current params are not passed along.


Should you decide to write the pagination links yourself, it''s pretty
easy to just change the page number in the url (and keep the other -
search - parameters) :

in application_helper.rb:
----------------------------
  def link_to_page(i)
     link_to i, params.merge({:page =>i})
  end

More generally, url_for can often be called with only the parameter(s)
you can to change, because the missing values will be filled from the
current request parameters.
Ex:
     url_for(:language => ''sw'')

see:
   http://api.rubyonrails.org/classes/ActionController/Base.html#M000262


Alain
----
blog.ravet.com