Hi, I am a newbie to RoR. I am trying persist lang variable in the session. So in welcome_controller when a user clicks on a link named english welcome_controller def english session[:lang] = ''E'' render :controller => ''login'' #which opens index.html where login info resides end In login_contrller def index lan = session[:lang] end When I inspected the session, first of all, welcome_controller session.id is different from login_controller session.id. Secondly, when I inspected the lan variable from login_controller, I got nil value. This is true if I inspected session[:lang] as well. What am I doing wrong? -- 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
session.id will be different in every method because you are fetching a new object based on the current session. When you go to /welcome/english you get no session info? Are you sure? Check your cookies after you go to the page (In FF go to Preferences -> Provacy => Show Cookies. Filter for "localhost" (unless you are checking an actual domain. There should be a session there. --jake Araviesh Araviesh wrote:> Hi, > I am a newbie to RoR. I am trying persist lang variable in the session. > So in welcome_controller when a user clicks on a link named english > > > welcome_controller > > def english > session[:lang] = ''E'' > render :controller => ''login'' #which opens index.html where login > info resides > end > > > In login_contrller > > def index > lan = session[:lang] > end > > When I inspected the session, first of all, welcome_controller > session.id is different from login_controller session.id. Secondly, when > I inspected the lan variable from login_controller, I got nil value. > This is true if I inspected session[:lang] as well. What am I doing > wrong?-- 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---