# Ensure single session per user at a time

**URL:** <https://www.ruby-forum.com/t/ensure-single-session-per-user-at-a-time/182249>\
**Category:** Rails\
**Created:** [January 25, 2010, 5:32pm UTC](https://www.ruby-forum.com/t/ensure-single-session-per-user-at-a-time/182249 "2010-01-25T17:32:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![paerez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/5fc32e/32.png) [@paerez](https://www.ruby-forum.com/u/paerez)\
**Post date:** [January 25, 2010, 5:32pm UTC](https://www.ruby-forum.com/t/ensure-single-session-per-user-at-a-time/182249/1 "2010-01-25T17:32:04Z")

</div>

Thank you in advance to anyone that can help me solve this one!

I would like to ensure that each user authenticated with restful-auth.  
has only a single session at a time. If a user has a session open on  
computer A, I want the next place that user logs in (computer B) to  
kill/destroy/remove the computer A’s session - for Example. (Same  
situation with multiple browsers on a single computer.) This way I can  
make sure that each company account has many users with their OWN user  
account. (Company has many users - user belongs to company) I don’t  
want to force the new log in to be restricted until old session has been  
destroyed or expired, I rather just kill the first session and allow the  
new login on through.

I am using restful-auth (technoweenie) and active\_record\_session store.  
I have tried using logged\_in? call and other conditional statements but  
nothing seems to work.

Please let me know if anyone has any ideas, if there are any solutions  
already and any help!

Thank you,

Nickmenow
