Re: User Login

Cayce Balara
Tue, 03 Jun 2008 02:02:42 -0000

cz231 wrote:
> Oops, sorry about that, I accidentally sent it somehow...
>
> Anyway, for the <% if session[:uid] = @user.id -%> , I don''t
know what
> would go in there...
>
> Thanks for your help...

Really all you want to know is if there is a session[:uid] -

<% if session[:uid] %>

if there is then the user is logged in, otherwise it will be nil.

However, there''s some more to it. I would recommend you pull down the
restful_authentication plugin, run the generator and then examine the
code to see how they do all this, which will teach you a lot.

For instance, Restful_Authentication exposes the currently logged in
user with "current_user" and also methods like "logged_in?"
and
"authorized?" that will assist with what you are trying to do.
--
Posted via http://www.ruby-forum.com/.