Forum: Ruby on Rails restful auth problem

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Matt H. (Guest)
on 2008-12-17 23:11
(Received via mailing list)
Hi folks,

I have been working on a website and I used restful auth as a starting
point for the authentication.

Suddenly (I don't think I broke it but I don't know) it has started
throwing me a weird problem.

I have a view that checks to see if the user is logged in (logged_in?)
and if yes, check the user's roles (current_user.has_role?) and display
a menu accordingly.

The login check seems to return true for non-authenticated users and
thus falls over when it tries to get the roles (no method:

I have definitely not fiddled with the restful auth libs, like
authenticated_system.rb. I have gone back and checked the svn logs to
see what else I might have broken, but I can't find a trace.

I don't know where to start tracking this problem down, I looked at the
code for logged_in? and it's so simple I don't see how it could have got

Any ideas welcomed as I'm pretty much stuck


Matt H. (Guest)
on 2008-12-18 01:09
(Received via mailing list)

I was looking at the wrong line...doh

The actual problem was I had used "has_role?" later on in the layout but
hadn't wrapped it with "if logged_in?".

Lets just keep quiet about this one :P
This topic is locked and can not be replied to.