# Sessions Problems

**URL:** <https://www.ruby-forum.com/t/sessions-problems/58985>\
**Category:** Rails\
**Created:** [April 27, 2006, 4:27pm UTC](https://www.ruby-forum.com/t/sessions-problems/58985 "2006-04-27T16:27:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kumar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/9f8e36/32.png) [@kumar](https://www.ruby-forum.com/u/kumar)\
**Post date:** [April 27, 2006, 4:27pm UTC](https://www.ruby-forum.com/t/sessions-problems/58985/1 "2006-04-27T16:27:41Z")

</div>

Hi to group!

I am new to ROR!

I am facing problems on sessions.

First I created the one session variable.

after that I created the other one.

after moving to three pages the session was destroyed automatically.

What is the reason please help me!

Thnaks and Regards,  
-Kumar Varma

---

<div class="post-metadata">

**Author:** ![kumar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/9f8e36/32.png) [@kumar](https://www.ruby-forum.com/u/kumar)\
**Post date:** [April 27, 2006, 4:46pm UTC](https://www.ruby-forum.com/t/sessions-problems/58985/2 "2006-04-27T16:46:14Z")

</div>

Is one of your pages overwriting the values? You might try:

\<%= debug session %\>

In your main layout to watch what is happening to the session.

~ Ben

On 4/27/06, Kumar [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> –  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

–  
Ben R.  
[http://www.benr75.com](http://www.benr75.com)

---

<div class="post-metadata">

**Author:** ![kumar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/9f8e36/32.png) [@kumar](https://www.ruby-forum.com/u/kumar)\
**Post date:** [April 28, 2006, 6:47am UTC](https://www.ruby-forum.com/t/sessions-problems/58985/3 "2006-04-28T06:47:45Z")

</div>

Ben R. wrote:

> Is one of your pages overwriting the values? You might try:
> 
> \<%= debug session %\>
> 
> In your main layout to watch what is happening to the session.
> 
> ~ Ben
> 
> On 4/27/06, Kumar [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Dear Sir! Please resoleve this problem

I tryed with this in the main layout

In First Page

— !ruby/object:CGI::Session  
data: &id001  
flash: !map:ActionController::Flash::FlashHash {}

dbman: &id002 !ruby/object:CGI::Session::PStore  
hash: \*id001  
p: !ruby/object:PStore  
abort: false  
filename:  
./script/…/config/…/tmp/sessions//ruby\_sess.80c276a05c5f63ec  
rdonly: false  
table:  
transaction: false  
dbprot:

- \*id002  
new\_session: true  
session\_id: 85a794d70db26e657042b6cf5e676cbb  
write\_lock: true

In Second page also same

but we are creating other session is i.e sessiuon[:username]

In third page

— !ruby/object:CGI::Session  
data: &id001  
:username: admin  
:checking:  
flash: !map:ActionController::Flash::FlashHash {}

dbman: &id002 !ruby/object:CGI::Session::PStore  
hash: \*id001  
p: !ruby/object:PStore  
abort: false  
filename:  
./script/…/config/…/tmp/sessions//ruby\_sess.2f5da197f2fc548f  
rdonly: false  
table:  
transaction: false  
dbprot:

- \*id002  
new\_session: false  
session\_id: 62971ba072a87e78cbd7f0ee2630ab79  
write\_lock: true

Thanks and Regards,

Kumar

> > –  
> > Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> > 
> > * * *
> > 
> > Rails mailing list  
> > removed\_email\_address@domain.invalid  
> > [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)
> 
> –  
> Ben R.  
> [http://www.benr75.com](http://www.benr75.com)

---

<div class="post-metadata">

**Author:** ![kumar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/9f8e36/32.png) [@kumar](https://www.ruby-forum.com/u/kumar)\
**Post date:** [April 28, 2006, 4:23pm UTC](https://www.ruby-forum.com/t/sessions-problems/58985/4 "2006-04-28T16:23:48Z")

</div>

Kumar wrote:

> > On 4/27/06, Kumar [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:  
> > — !ruby/object:CGI::Session  
> > table:  
> > transaction: false  
> > dbprot:
> 
> - \*id002  
> new\_session: true  
> session\_id: 85a794d70db26e657042b6cf5e676cbb

> — !ruby/object:CGI::Session  
> ./script/…/config/…/tmp/sessions//ruby\_sess.2f5da197f2fc548f
> 
> > > * * *

I am having the same problem. I figured out it is due to having  
multiple rails apps on the same hostname [mybox.mydomain.com](http://mybox.mydomain.com). Each Rails  
app is overwriting the session variable of the other Rails app. Here is  
the solution.

[http://wiki.rubyonrails.com/rails/pages/HowtoChangeSessionOptions](http://wiki.rubyonrails.com/rails/pages/HowtoChangeSessionOptions)

---

<div class="post-metadata">

**Author:** ![kumar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/9f8e36/32.png) [@kumar](https://www.ruby-forum.com/u/kumar)\
**Post date:** [March 10, 2007, 9:51am UTC](https://www.ruby-forum.com/t/sessions-problems/58985/5 "2007-03-10T09:51:12Z")

</div>

> I am having the same problem. I figured out it is due to having  
> multiple rails apps on the same hostname [mybox.mydomain.com](http://mybox.mydomain.com). Each Rails  
> app is overwriting the session variable of the other Rails app. Here is  
> the solution.
> 
> [Peak Obsession](http://wiki.rubyonrails.com/rails/pages/HowtoChangeSessionOptions)

I have the same problem but i’m working on localhost and i have only one  
started application. I don’t know why after visiting some pages,  
sessions values are destroyed.

Help please!
