Problem with sessions


Does anyone know is it possible to have more than one sessions in a web application? If it is possible, can someone please tell me how can I acheive this?

Thanks fries 88

Why would you want to do this?

Ryan Bigg wrote:

Why would you want to do this?

Posted via


-- Ryan Bigg Feel free to add me to MSN and/or GTalk as this email.

I kept counters in the session. Then I assigned counters to my page so that when I first enter the page, I will be able to save and the subsequent time I enter the same page I will be able to edit the data I saved previously. I have to do this for many other pages too. So I was thinking of having one session for a page. But I am not sure if it is right or possible.


def find_count       session[:count] ||= 0       session[:count] += 1

    if session[:count] == 1       redirect_to :action => 'prod_desc'     else       redirect_to :action => 'update_prod_desc'

      end     end

I'm not sure what you're trying to do but can't you do:

session[:count] and then session[:othercount]

I dont think this is the right way to go about it.

You should have a link to create the data, and then another link to edit. You can decide which one shows by checking to see if the data exists before doing it.

It sounds like you’re over-complicating something.

One thing you can do is reference each page in the session. Something like


If you want to automate it completely, you can even do


though I would probably convert controller_name and action_name to symbols with


On the other hand, if you only want to do manually, you can use a before filter to set a variable that you then use as the key into the session hash.

Having said that, Ryan might be onto something. You might want to step back and re-evaluate your requirements to see if you are overcomplicating some process.

Peace, Phillip