On Nov 24, 10:25 pm, John Small <[EMAIL PROTECTED]>
wrote:
> I have a search form which sends a set of params to a controller. The
> params are unpacked and SQL generated which is then fed into
> (1)
> MyModel.paginate_by_sql [sql],:page => params[:page], :per_page => 30
>
> Which all works fine and lovely, on the first page..
>
> The links in each of the visible page buttons simply point to
> /controller/search_action?page=2 or 3 & so on. All the params used to
> create the sql are missing. So when the call comes in for the next page,
> only clean no selection sql is generated and I get the second (or third
> & etc) page of the entire data set, not the sub-set selected by the
> form.
>
> When I do this by
> (2)
> AnOtherModel.find_with_ferret  params[:search_for],
> {:page=>params[:page], :per_page => 30}
>
> then search_for=something is added to the params list attached to the
> pagination links, so I can page back and forth in a search result set.
> So that works OK.
>
> How do I get the params for my query in (1) to be added to the
> pagination links so I get the params back to redo the query for the next
> page?

Well you can always add params, it's one option that you pass to the
will_paginate method. If the request being handled is a get then the
params that made up that request will be added automatically too.

Fred
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to