Session information

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?

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?