Extracing a cookie before the cookie is set


#1

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


#2

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