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

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