Setting a session variable, :value and :session_path

Hello,

I’m having some difficulty with using sessions. Basically, I’d like to
be
able to store a hash in an action:

def action
session[:details] = {:value => some_hash, :session_path => “/main”}
end

I’d like to be able to retrieve the hash in another action under the
same
“main” controller. I retrieve it by doing the following:

def action2
hash = session[:details]

v1 = hash[:name] # Problem is that this is null
end

I’m not able to get my values out as I expect. Any help would be
appreciated. Also, when I set :session_path => ‘/main’, does this mean
that
the session[:details] will get nulled if a user were to get out of the
“main” controller path?

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