Session variable question

I am having some weird behavior I don’t get.

Within a controller/class I have a method “test1” that sets
@session[‘varname’]=“foo”. the view for test1.rhtml properly prints the
value as “foo”.

Next I click a link to method “test2” within the same class (same
browser sesion etc). test2 attempts to access @session[‘varname’] and
finds it nil. DANGIT

I found if I were to put in “test1” method a redirect_to “test2” that
test2 is able to access the data properly.

What am I missing about how session variables work?

Mike K. wrote:

I am having some weird behavior I don’t get.

Within a controller/class I have a method “test1” that sets
@session[‘varname’]=“foo”. the view for test1.rhtml properly prints the
value as “foo”.

Next I click a link to method “test2” within the same class (same
browser sesion etc). test2 attempts to access @session[‘varname’] and
finds it nil. DANGIT

I found if I were to put in “test1” method a redirect_to “test2” that
test2 is able to access the data properly.

What am I missing about how session variables work?

Somebody posted here the other day that “@session[]” is deprecated. He
suggested switching to just “session[]” and thought that would solve the
OP’s problem. I didn’t see the thread after that so I don’t know if it
was a successful solution or not. Worth a try. Please let us know.

thanks,
jp