# Multiple sessions?

**URL:** <https://www.ruby-forum.com/t/multiple-sessions/87254>\
**Category:** Rails\
**Created:** [March 1, 2007, 7:54am UTC](https://www.ruby-forum.com/t/multiple-sessions/87254 "2007-03-01T07:54:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pond](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/7ab992/32.png) [@pond](https://www.ruby-forum.com/u/pond)\
**Post date:** [March 1, 2007, 7:54am UTC](https://www.ruby-forum.com/t/multiple-sessions/87254/1 "2007-03-01T07:54:30Z")

</div>

So here’s the situation:

I’m working on a Rails site that needs to have two separate  
authenticated areas (the cms and a shopping cart). I haven’t begun  
working on the shopping cart yet, but I need to figure out the best way  
to approach having those two areas not step on each other’s feet.

I want to keep the sessions separate. What’s the best way handle that  
with Rails? I’m guessing that by default, I’m going to be working with  
the same session in both areas.

---

<div class="post-metadata">

**Author:** ![pond](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/7ab992/32.png) [@pond](https://www.ruby-forum.com/u/pond)\
**Post date:** [March 1, 2007, 9:14am UTC](https://www.ruby-forum.com/t/multiple-sessions/87254/2 "2007-03-01T09:14:35Z")

</div>

> I want to keep the sessions separate. What’s the best way handle that  
> with Rails? I’m guessing that by default, I’m going to be working with  
> the same session in both areas.

you may want to take a look at this  
[http://api.rubyonrails.com/classes/ActionController/SessionManagement/ClassMethods.html#M000128](http://api.rubyonrails.com/classes/ActionController/SessionManagement/ClassMethods.html#M000128)  
and this [http://www.ruby-doc.org/core/classes/CGI/Session.html#M000553](http://www.ruby-doc.org/core/classes/CGI/Session.html#M000553)

As you see, you can specify different per action options, and one of the  
options is the session key (which rails 1.2.0 and above set by deffault  
at the application controller).

regards,

javier ramirez

## –

Estamos de estreno… si necesitas llevar el control de tus gastos  
visita [http://www.gastosgem.com](http://www.gastosgem.com) !!Es gratis!!
