Always passing the same params

Hi, I’m building an application that have many types of search requests
like simple search, search within results, sort results, sort the
displaying fields, show/hide fields…
To do this I’m using several params[:X] variables which I’m passing all
the time from one method to another.
I’m passing those params with GET (through the URL) wich I don’t like at
all. So:

  1. which would be a better way to do it insteaf of GET?. And

  2. is there an automated way to pass all the params (or the ones I’d
    choose) from one request to another?

Thanks.

Yes,
You can store all those variables in a session variable. Sessions
allow you to store variables between requests, and give you ‘state’.

In your controllers, you can assign a session variable:

def index
session[:my_first_setting] = nil
end

def change_setting
session[:my_first_setting] = params[:setting1]
end

def search
order = session[:my_first_setting] ? “updated_at DESC” : “updated_at
ASC”
@results = Items.find(:all, :order => order)
end

You can store almost any data object in a session hash.

On Mar 30, 12:18 pm, Fernando P. <rails-mailing-l…@andreas-

First, thx for your answer.

John T. wrote:

You can store all those variables in a session variable. Sessions
allow you to store variables between requests, and give you ‘state’.

Yes, sessions give you ‘state’ which is the best approach for
applications like a shopping cart. However, session is not good for me
(I think) because the users of my application may use more than one
navigation window and I don’t want ‘state’ between them, wich will
happen if I use sessions.

You can use flash (ie. flash[:my_variable] = my_data) to pass
information from one action to the next. Be careful how you use it. I
have ran into some problems passing variables back to the same action
using different request methods.

On Mar 30, 10:35 am, Fernando P. <rails-mailing-l…@andreas-