# Question RE: ActionController::Base.session and ActionController::Base.session\_store

**URL:** <https://www.ruby-forum.com/t/question-re-actioncontroller-base-session-and-actioncontroller-base-session-store/195662>\
**Category:** Rails\
**Created:** [September 27, 2010, 9:23pm UTC](https://www.ruby-forum.com/t/question-re-actioncontroller-base-session-and-actioncontroller-base-session-store/195662 "2010-09-27T21:23:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![khagimoto](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ee59a6/32.png) [@khagimoto](https://www.ruby-forum.com/u/khagimoto)\
**Post date:** [September 27, 2010, 9:23pm UTC](https://www.ruby-forum.com/t/question-re-actioncontroller-base-session-and-actioncontroller-base-session-store/195662/1 "2010-09-27T21:23:51Z")

</div>

I had been using the cookie-based session until recently, then  
switched to using active\_record\_store (db) as it said:

# Use the database for sessions instead of the cookie-based default,

# which shouldn’t be used to store highly confidential information

in the session\_store.rb file.

Everything works fine, but I don’t really understand why it’s still  
setting a cookie instead of just using the session db. Is that a  
normal behavior when using a database for session management?

---

<div class="post-metadata">

**Author:** ![khagimoto](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ee59a6/32.png) [@khagimoto](https://www.ruby-forum.com/u/khagimoto)\
**Post date:** [September 27, 2010, 9:38pm UTC](https://www.ruby-forum.com/t/question-re-actioncontroller-base-session-and-actioncontroller-base-session-store/195662/2 "2010-09-27T21:38:29Z")

</div>

I see the difference now - with the session\_store db instead of the  
cookie, the cookie is a mere reference to the record in the db. So  
that makes it more secure than the cookie-based.  
But I still have a question about the life of the session record in  
the session db. It doesn’t seem to get deleted when the session  
ends. Is there a method to do that with this class? Thanks!

---

<div class="post-metadata">

**Author:** ![khagimoto](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ee59a6/32.png) [@khagimoto](https://www.ruby-forum.com/u/khagimoto)\
**Post date:** [September 27, 2010, 9:55pm UTC](https://www.ruby-forum.com/t/question-re-actioncontroller-base-session-and-actioncontroller-base-session-store/195662/3 "2010-09-27T21:55:28Z")

</div>

you are suppose to deleted manually, you can create a rake task and set  
up a  
crontab.

---

<div class="post-metadata">

**Author:** ![khagimoto](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ee59a6/32.png) [@khagimoto](https://www.ruby-forum.com/u/khagimoto)\
**Post date:** [September 27, 2010, 10:26pm UTC](https://www.ruby-forum.com/t/question-re-actioncontroller-base-session-and-actioncontroller-base-session-store/195662/4 "2010-09-27T22:26:30Z")

</div>

thanks, radhames brito.  
I was hoping it was done automagically somehow… , but found a good  
reference… 🙂

> **[1xbet в Беларуси - Обзор букмекерской конторы](https://translated.by/)**
>
> Независимый обзор деятельности букмекера 1хБет в Беларуси. Как быстро зарегистрироваться в 1хБет белорусским игрокам. Выгодные акции и бонусы конторы.
