# Sessions and subdomains

**URL:** <https://www.ruby-forum.com/t/sessions-and-subdomains/175452>\
**Category:** Rails\
**Created:** [September 14, 2009, 8:27am UTC](https://www.ruby-forum.com/t/sessions-and-subdomains/175452 "2009-09-14T08:27:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![elioncho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ed8c4c/32.png) [@elioncho](https://www.ruby-forum.com/u/elioncho)\
**Post date:** [September 14, 2009, 8:27am UTC](https://www.ruby-forum.com/t/sessions-and-subdomains/175452/1 "2009-09-14T08:27:28Z")

</div>

Hello,

I’m currently developing an application in which accounts are managed  
by subdomains ([foo.example.com](http://foo.example.com),[bar.example.com](http://bar.example.com)…). I was wondering  
which is the best way to enable users to navigate through different  
accounts. The options are:

1. Leave your subdomain and keep your session across multiple  
subdomains allowing users to navigate through each account. (I think  
I’ll have to modify some session variables in environment.rb)
2. Stay on your own subdomain and have a new resource set to navigate  
between accounts without leaving your own subdomain (ex:  
[foo.example.com/accounts/1](http://foo.example.com/accounts/1), [foo.example.com/accounts/2](http://foo.example.com/accounts/2))

Which should be the best option and why (pros and cons)? Thanks,

---

<div class="post-metadata">

**Author:** ![elioncho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ed8c4c/32.png) [@elioncho](https://www.ruby-forum.com/u/elioncho)\
**Post date:** [September 14, 2009, 7:26pm UTC](https://www.ruby-forum.com/t/sessions-and-subdomains/175452/2 "2009-09-14T19:26:04Z")

</div>

Please can anyone pinpoint in some direction on what’s the best  
approach?
