# Session data is not saved in the session file although file created (using :p\_store)

**URL:** <https://www.ruby-forum.com/t/session-data-is-not-saved-in-the-session-file-although-file-created-using-p-store/148325>\
**Category:** Rails\
**Created:** [September 11, 2008, 7:03pm UTC](https://www.ruby-forum.com/t/session-data-is-not-saved-in-the-session-file-although-file-created-using-p-store/148325 "2008-09-11T19:03:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gabriel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/9de0a6/32.png) [@gabriel](https://www.ruby-forum.com/u/gabriel)\
**Post date:** [September 11, 2008, 7:03pm UTC](https://www.ruby-forum.com/t/session-data-is-not-saved-in-the-session-file-although-file-created-using-p-store/148325/1 "2008-09-11T19:03:30Z")

</div>

Hi all,

I am new to Rails. I want to test some things with sessions. But I  
simply cannot make them work. I am using this in the environment.rb  
file:

config.action\_controller.session\_store = :p\_store  
config.action\_controller.session = {  
:tmpdir =\> “#{RAILS\_ROOT}/tmp/sessions/”,  
:session\_key =\> ‘\_tests\_session’,  
:secret =\>  
‘f23e19a920da3ccb0a128f24d97a85e36618b7e6dc920167febe16f24ca89462d5bf83598d87d2d842c1fd273bb7df98b23ee6291c8fe6bfe8fdcf973929b645’  
}

The file “ruby\_sess.d38fcbeda549de99” is created in my “#{RAILS\_ROOT}/  
tmp/sessions/” directory.

In one controller I have the following code:

class SecController \< ApplicationController  
def sec  
session[:greeting] = “Hello world!”  
end  
end

and in a View:

Session: \<%= session[:greeting] %\>

…but on the web page I only find “Session:” written. I opened the  
session file and the “Hello World!” string was neither there.

If I create an application with InstantRails, everything works OK. I  
see the strings that I pus in the session on the view page and in the  
sesion file in the /tmp/sessions directory. I tried to compare the two  
applications (the one I created the one created inside InstantRails  
and modified by me to use the p\_store). Except the versions, I saw no  
other differences.

What am I missing? Is there a switch somewhere?

(I have the latest stable versions of ruby, gems and rails)

Thanks!
