Hi, I''m new to Rails, great framework! I''m using the login generator by Lucas Carlson. I need to find out who is logged in, preferably so I can use it in embedded ruby in an edit.rhtml page. Any help/pointers greatly appreciated. Thanks in advance! Regards, JJ
Once you are logged in, the user information is stored in the session and is accessible as: @session[''user''] -Dale On Fri, 28 Jan 2005 09:26:33 -0500, John Johnson <johnatl-ee4meeAH724@public.gmane.org> wrote:> Hi, > > I''m new to Rails, great framework! > > I''m using the login generator by Lucas Carlson. > > I need to find out who is logged in, preferably so I can use it in > embedded ruby in an edit.rhtml page. > Any help/pointers greatly appreciated. > > Thanks in advance! > > Regards, > JJ > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- This is my sig. Isn''t it cool....
On 28.1.2005, at 17:18, Dale K. Hawkins wrote:> Once you are logged in, the user information is stored in the session > and is accessible as: > > @session[''user'']That doesn''t help finding out which all users are logged in, I''m afraid. You might want to add a field like last_logged_in timestamp to the users table for that. Then you can decide for how long a user can be without loading a page until he''s considered being offline. You can also use a plain "logged_in" boolean switch but then you have to make sure that all users are somehow logged out after their session. //jarkko> > -Dale > > On Fri, 28 Jan 2005 09:26:33 -0500, John Johnson <johnatl-ee4meeAH724@public.gmane.org> > wrote: >> Hi, >> >> I''m new to Rails, great framework! >> >> I''m using the login generator by Lucas Carlson. >> >> I need to find out who is logged in, preferably so I can use it in >> embedded ruby in an edit.rhtml page. >> Any help/pointers greatly appreciated. >> >> Thanks in advance! >> >> Regards, >> JJ >> >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> > > > -- > This is my sig. Isn''t it cool.... > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Jarkko Laine http://jlaine.net http://odesign.fi _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Thanks Dale and Jarkko for the replies. After a little "Reflection" :-) I found the attributes I was looking for using: <table> <% @session[''user''].attributes.each { |k, v| %> <tr><td><%= k %></td><td><%= v %></td></tr> <% } %> </table> at the top of a .rhtml file. That''s a start, now to tie this to another table or more fields to use as an ACL. Thanks again, JJ On 28-Jan-2005, at 10:18, Dale K. Hawkins wrote:> Once you are logged in, the user information is stored in the session > and is accessible as: > > @session[''user''] > > -Dale > > On Fri, 28 Jan 2005 09:26:33 -0500, John Johnson <johnatl-ee4meeAH724@public.gmane.org> > wrote: >> Hi, >> >> I''m new to Rails, great framework! >> >> I''m using the login generator by Lucas Carlson. >> >> I need to find out who is logged in, preferably so I can use it in >> embedded ruby in an edit.rhtml page. >> Any help/pointers greatly appreciated. >> >> Thanks in advance! >> >> Regards, >> JJ >> >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> > > > -- > This is my sig. Isn''t it cool.... > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >