Request.new_session?

Okay, someone smarter than me needs to add this to the Rails
framework. It would be great if whenever a new session_id is created,
the request object gets a “new_session?” attribute. This is kind-of
like the ActiveRecord object and the “new_record?” attribute.

I know this could be accomplished by creating session variables, but I
still think this is a more elegant solution. I just wish I was smart
enough to pull it off :slight_smile:

Thanks,
Tom

Nice! Thanks Greg! I didn’t catch that in the API!

On Jun 23, 2008, at 6:59 PM, TomRossi7 wrote:

Okay, someone smarter than me needs to add this to the Rails
framework. It would be great if whenever a new session_id is created,
the request object gets a “new_session?” attribute. This is kind-of
like the ActiveRecord object and the “new_record?” attribute.

It’s already there, it just doesn’t use ? for some reason.

If you output your session using <%= debug(session) %> you’ll see
that there is a new_session key already.

This works for me: <%= debug(session.new_session.to_s) %>

and I get the appropriate true & false results.

– gw