Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8576501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:56:15+00:00 2026-06-11T19:56:15+00:00

Usually, index pages have options for filtering, page, sorting. After going to show, new,

  • 0

Usually, index pages have options for filtering, page, sorting. After going to show, new, edit page, you may want to get back to the index page with the same options as you saw.

To do that, I save the params for index in session.

class ApplicationController < ActionController::Base

  helper_method :index_with_params
  after_filter :save_index_params, :only => [:index]

  def save_index_params 
    session[self.class.to_s] = params 
  end

  def index_with_params overrider={}
    object = self.kind_of?(ApplicationController) ? self : controller
    h = session[object.class.to_s] || {"action" => :index}
    h["only_path"] = true
    url_for(h.merge(overrider));
  end

end

I used to use ActiveRecord for session store. Now I want to use cookie. So session should be light.

How do you handle such a case?

Thanks.

Sam

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T19:56:16+00:00Added an answer on June 11, 2026 at 7:56 pm

    After going to show, new, edit page, you may want to get back to the
    index page with the same options as you saw.

    If you pass your filtering options in the query string initially ie. example.com/widgets?order_by=price, then when your users navigate back to the index using the browser “Back” button, the filtering options will be preserved.

    If you really want the options to be preserved when the user later types in example.com/widgets, then you need to persist the options somewhere, typically in the session object. The cookie store can accommodate up to 4KB so should be fine unless you have a lot of options. If you need more space or performance becomes an issue, look at other session stores, for example Redis Store.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Usually I have the main page (index.php) that include header/footer/menu and the content of
I have a URL that would be like so: http://mysite.com/index.php?somename=somevalue I usually check that
I usually like defining my pages to know exactly what page does what. However,
I have a standard CRUD forum with posts and comments. Currently the index page
I have a custom page in ActiveAdmin called statistics, where I want to display
Usually, on twitter tweet button, if I don't specify data-text it take the page
Usually, we only put the data we want to send as websocket.send() method's parameter,
Usually, in order to launch a new Activity and get its result, from an
Folks, I am completely new to jQuery and JqGrid both. Usually I take some
or any of the other search options? I usually disable all background indexing on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.