I’m trying to set a session variable in one action of
application_controller.rb, which is then accessed in a second action of
the same controller following a redirect.
Here’s the code.
render :template => “shared/cookies_required”
#redirect back to where the user came from
return true unless cookies[“cookie_test”].blank?
session[:return_to] = request.request_uri
cookies[“cookie_test”] = Time.now
redirect_to :action => “cookie_test” and return false
The method ‘cookies_required’ is called first, which sets the session
I would like to be able to access this variable in the method
‘cookie_test’ following the redirect.
However, when I try to do so, it shows up as nil.
I tried replacing the session variable with a global variable and that
I also tried sending the ‘request.request_uri’ variable as a parameter
to the second action and that worked too.
But why is my session variable dying following the redirect??
Thanks in advance