Forum: Ruby on Rails having problems with global variable

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Ed8a168d9dcb0072438c535b23bc8f38?d=identicon&s=25 Jay Dev (mercuryguy)
on 2007-07-27 16:40
Hi all,
I am working on a webapp where a user can login, the login process binds
with LDAP to see if the user is in LDAP. If its successful, I store the
params[:login] to a global variable so I can use that in the rest of the

The problem is:
When i open up two browser windows and login in with two different
users, the variable is set to the user information used in the second
login. So when I switch back to the first browser window and refresh, I
see the second user information. Hopefully this makes sense, if not
please let me know. I will rephrase it.

18174abcca5cd20f9260a51749f8b011?d=identicon&s=25 Adam Gardiner (agardiner)
on 2007-07-29 14:33
That behaviour is to be expected if you are using a global variable...
What you probably want to be doing is storing it in a session variable
This topic is locked and can not be replied to.