I have some photos that are split on successive pages through will_paginate plugin. When you open a photo and then return to all photos using a link, you always return to th
Here's another solution: will_paginate just uses query string parameters 'search_field' and 'page'; you can extract these from the Rails params hash. If you keep track of those using session state, you can reapply them in your controller code, when needed.
Exactly how you manage that will depend on your application. In the app I'm working on, the flow is such that I can distinguish between a general context and a member context. The user enters the member context from the member#index page. So I just set session[:member_context] on entry to the member context; e.g. in members#edit. Then, in the members#index, I have the following code:
if session[:member_context]
@search_field = session[:search_field]
@page = session[:page]
# toggle out of member context
session[:member_context] = nil
else
@search_field = params[:search_field]
@page = params[:page]
# record lastest search in case the user subsequently enters the member context
session[:search_field] = @search_field
session[:page] = @page
end
@members = Member.where(
This works great in my application.