Skip to content

Instantly share code, notes, and snippets.

@tejo
Forked from CootCraig/store_page_on_session
Created February 22, 2011 20:10
Show Gist options
  • Save tejo/839282 to your computer and use it in GitHub Desktop.
Save tejo/839282 to your computer and use it in GitHub Desktop.
class ApplicationController < ActionController::Base
before_filter :page_params, :only => :index
def page_key
(self.class.to_s + "_page").to_sym
end
def page_params
if params[:page] then
session[page_key] = params[:page]
elsif session[page_key]
params[:page] = session[page_key]
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment