@session is getting reset?

I got rid of the @ signs and went from strings to symbols,
but things are still broken:

At the end of the login method (user_controller.rb), I’m
setting values into session, then redirecting, as:

  puts ">>>>>  redirecting"                  # TRACE
  session[:user] = u.id
  session[:foozle] = 'bar' #{T}
  if (session[:foozle])
    puts ">>>>>  login: foozle = '#{session[:foozle]}'"
  else
    puts ">>>>>  login: foozle is undefined"
  end

  redirect_to :controller => 'main',
              :action     => 'welcome'

This prints out

redirecting
login: foozle = ‘bar’

Then, in get_user (application.rb), I try to retrieve them:

if (session)
  puts ">>>>>  session is defined in get_user"
  puts ">>>>>  class  = #{session.class}"
  if (session[:foozle])
    puts ">>>>>  get_user: foozle = '#{session[:foozle]}'"
  else
    puts ">>>>>  get_user: foozle is undefined"
  end
else
  puts ">>>>>  session is undefined in get_user"
end

This prints out

session is defined in get_user
class = CGI::Session
get_user: foozle is undefined
session[:user] is undefined

Oh yeah:

% rails --version
Rails 1.1.6

-r

http://www.cfcl.com/rdm Rich M.
http://www.cfcl.com/rdm/resume [email protected]
http://www.cfcl.com/rdm/weblog +1 650-873-7841

Technical editing and writing, programming, and web development

Hi Rich,

Rich M. wrote:

I got rid of the @ signs and went from strings to symbols,
but things are still broken:

I’ve been through it and honestly can’t see the problem either. Sorry I
can’t be more help. I do hope you’ll post what you find here, though.
Something on the wiki would be cool too.

Best regards,
Bill

On Fri, Oct 13, 2006, Rich M. wrote:

I got rid of the @ signs and went from strings to symbols,
but things are still broken:

I just copied/pasted your code into a test application, and it
WORKSFORME. Either your environment is screwed up, or some code that
you’re not showing us is breaking it.

Try to copy exactly what you sent out into a new application and give it
a go. You’ll have to change u.id to something else… if that works
fine, then your session is getting munged somewhere else in your app.

Ben

(coming into this conversation late…)

possible write error(permissions) in your session folder?

J

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs