Hi, 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. def cookie_test if cookies["cookie_test"].blank? render :template => "shared/cookies_required" else #redirect back to where the user came from end end protected def cookies_required 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 end The method 'cookies_required' is called first, which sets the session variable 'session[:return_to]'. 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 worked fine. 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 -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.