# Test for user logged in

**URL:** <https://www.ruby-forum.com/t/test-for-user-logged-in/138324>\
**Category:** Rails\
**Created:** [May 22, 2008, 1:45am UTC](https://www.ruby-forum.com/t/test-for-user-logged-in/138324 "2008-05-22T01:45:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![joel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9bd4f/32.png) [@joel](https://www.ruby-forum.com/u/joel)\
**Post date:** [May 22, 2008, 1:45am UTC](https://www.ruby-forum.com/t/test-for-user-logged-in/138324/1 "2008-05-22T01:45:22Z")

</div>

Hello people,

Still a newbie in rails, wanted to know if there is a way to test if  
there is a user actually logged in from controller action code ? I’m  
using restful authentication .

Regards,

Joel

---

<div class="post-metadata">

**Author:** ![joel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9bd4f/32.png) [@joel](https://www.ruby-forum.com/u/joel)\
**Post date:** [May 22, 2008, 2:38am UTC](https://www.ruby-forum.com/t/test-for-user-logged-in/138324/2 "2008-05-22T02:38:35Z")

</div>

How about using the logged\_in? method. That should do the trick for  
you.

By the way take a look though lib/authenticated\_system.rb. You’ll find  
lots of cool stuff in there.
