# How to check if a user is logged in

**URL:** <https://www.ruby-forum.com/t/how-to-check-if-a-user-is-logged-in/107501>\
**Category:** Rails\
**Created:** [June 22, 2007, 10:45am UTC](https://www.ruby-forum.com/t/how-to-check-if-a-user-is-logged-in/107501 "2007-06-22T10:45:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wings](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/e495f1/32.png) [@wings](https://www.ruby-forum.com/u/wings)\
**Post date:** [June 22, 2007, 10:45am UTC](https://www.ruby-forum.com/t/how-to-check-if-a-user-is-logged-in/107501/1 "2007-06-22T10:45:51Z")

</div>

Hi there, I wonder if anyone can help me with this please?

If I have a page that I want to be accessible both prior and post login.  
But if the user is logged in, I would want to display the it as a SSL  
page, and if user is not logged in, I would display it as normal. I have  
used

If session[:user]

SSL required :index

End

However, this gives an type error, says session[:user] is an array?

What am I doing wrong?

Thanks in advance.
