Session data is not saved in the session file although file created (using :p_store)

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

config.action_controller.session_store = :p_store
config.action_controller.session = {
:tmpdir => “#{RAILS_ROOT}/tmp/sessions/”,
:session_key => ‘_tests_session’,
:secret =>

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!”

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)


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs