Sessions test


#1

hey everyone,
im trying to set up a quick sessions test and cant get the thing to
work. ive got to be missing something tiny…

the controller goes:
def session_test
session[:greeting] = “good morning”
end

and the view goes:
<%= @session[:greeting] %>

all of this gets me a blank screen. when i set the view to dump all the
session data “session{}” it returns “#”

thanks.


#2

nevermind… figured it out. :slight_smile:


#3

On Apr 14, 2006, at 3:51 PM, human wrote:

<%= @session[:greeting] %>
Don’t use @session. It’s deprecated and the core folks want people
using session instead. :slight_smile:

all of this gets me a blank screen. when i set the view to dump all
the
session data “session{}” it returns “#”

How do you “set” it to do that?

Could I suggest session.inspect

Generally speaking, blank screens frequently involve session file
issues. Try clearing your session files and trying again.

What you’re trying to do should work. Of course, session is generally
used for inter-request communications, and is not required for
controller-view communications, a pedestrian controller instance
attribute (begins with @) would work fine for that.


– Tom M.