Forum: Ruby on Rails sessions test

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C90892aef738a2e370ad11b87ea036e6?d=identicon&s=25 Human --- (human)
on 2006-04-15 00:51
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.
C90892aef738a2e370ad11b87ea036e6?d=identicon&s=25 Human --- (human)
on 2006-04-15 01:12
nevermind.... figured it out. :)
59de94a56fd2c198f33d9515d1c05961?d=identicon&s=25 Tom Mornini (Guest)
on 2006-04-15 01:20
(Received via mailing list)
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. :-)

> 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 Mornini
This topic is locked and can not be replied to.