# Request.new\_session?

**URL:** <https://www.ruby-forum.com/t/request-new-session/141259>\
**Category:** Rails\
**Created:** [June 24, 2008, 4:00am UTC](https://www.ruby-forum.com/t/request-new-session/141259 "2008-06-24T04:00:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 24, 2008, 4:00am UTC](https://www.ruby-forum.com/t/request-new-session/141259/1 "2008-06-24T04:00:31Z")

</div>

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 🙂

Thanks,  
Tom

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 24, 2008, 11:23pm UTC](https://www.ruby-forum.com/t/request-new-session/141259/2 "2008-06-24T23:23:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 24, 2008, 10:13pm UTC](https://www.ruby-forum.com/t/request-new-session/141259/3 "2008-06-24T22:13:34Z")

</div>

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
