# Do I need to use sessions if I don't store anything in them?

**URL:** <https://www.ruby-forum.com/t/do-i-need-to-use-sessions-if-i-dont-store-anything-in-them/135099>\
**Category:** Rails\
**Created:** [April 17, 2008, 9:25pm UTC](https://www.ruby-forum.com/t/do-i-need-to-use-sessions-if-i-dont-store-anything-in-them/135099 "2008-04-17T21:25:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![g0nzo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/3bc359/32.png) [@g0nzo](https://www.ruby-forum.com/u/g0nzo)\
**Post date:** [April 17, 2008, 9:25pm UTC](https://www.ruby-forum.com/t/do-i-need-to-use-sessions-if-i-dont-store-anything-in-them/135099/1 "2008-04-17T21:25:11Z")

</div>

Hi,

I got very small app that has user part and admin part. The problem is  
that after a while the sessions table has ~150mb. I don’t really need  
to store any user data in the session for the user part. I only need  
it for the admin part.

Can I simply turn session off in controllers from the user part? Are  
there any drawbacks of turning the session off?

Regards

---

<div class="post-metadata">

**Author:** ![g0nzo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/3bc359/32.png) [@g0nzo](https://www.ruby-forum.com/u/g0nzo)\
**Post date:** [April 17, 2008, 9:34pm UTC](https://www.ruby-forum.com/t/do-i-need-to-use-sessions-if-i-dont-store-anything-in-them/135099/2 "2008-04-17T21:34:35Z")

</div>

On 17 Apr 2008, at 20:24, szimek wrote:

> 

Just stick session :off  
in the relevant controllers.  
Other than not being able to use it, no.

Fred

---

<div class="post-metadata">

**Author:** ![g0nzo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/3bc359/32.png) [@g0nzo](https://www.ruby-forum.com/u/g0nzo)\
**Post date:** [April 18, 2008, 2:44pm UTC](https://www.ruby-forum.com/t/do-i-need-to-use-sessions-if-i-dont-store-anything-in-them/135099/3 "2008-04-18T14:44:32Z")

</div>

If you’re having non-admin users login then obviously you’re going to  
lose the ability to remember who they are unless you make their id  
part of every page/postback.

---

<div class="post-metadata">

**Author:** ![g0nzo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/3bc359/32.png) [@g0nzo](https://www.ruby-forum.com/u/g0nzo)\
**Post date:** [April 17, 2008, 10:09pm UTC](https://www.ruby-forum.com/t/do-i-need-to-use-sessions-if-i-dont-store-anything-in-them/135099/4 "2008-04-17T22:09:12Z")

</div>

On 17 Kwi, 21:33, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > Can I simply turn session off in controllers from the user part? Are  
> > there any drawbacks of turning the session off?
> 
> Just stick session :off  
> in the relevant controllers.  
> Other than not being able to use it, no.
> 
> Fred
> 
> > Regards

Thanks

---

<div class="post-metadata">

**Author:** ![g0nzo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/3bc359/32.png) [@g0nzo](https://www.ruby-forum.com/u/g0nzo)\
**Post date:** [April 21, 2008, 1:42pm UTC](https://www.ruby-forum.com/t/do-i-need-to-use-sessions-if-i-dont-store-anything-in-them/135099/5 "2008-04-21T13:42:56Z")

</div>

Also, you’ll lose the ability to have store messages in the flash.  
(flash[:whatever]) messages. In case that’s something you’re using  
currently.

RSL
