Restful auth problem


#1

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:
nil.has_role?)

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
broken.

Any ideas welcomed as I’m pretty much stuck

Thanks

Matt


#2

Solved…embarrasingly.

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 :stuck_out_tongue: