Forum: Ruby on Rails extracing a cookie before the cookie is set

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.
cranberry (Guest)
on 2006-02-23 17:41
I want to check it the @session[:user].id exists in an if statement.

However, I the user has not yet logged in, the following error occurs.
How does one check if this (or any other) cookie exists without getting
this error?

Thanks!


Account#manager
Called id for nil, which would mistakenly be 4 -- if you
really wanted the id of nil, use object_id
Gregory S. (Guest)
on 2006-02-23 17:47
(Received via mailing list)
On Thu, Feb 23, 2006 at 04:41:59PM +0100, cranberry wrote:
} I want to check it the @session[:user].id exists in an if statement.
}
} However, I the user has not yet logged in, the following error occurs.
} How does one check if this (or any other) cookie exists without
getting
} this error?

if @session[:user] && @session[:user].id

} Thanks!
--Greg
This topic is locked and can not be replied to.