AuthLogic - how to determine current user id throughout the system?

Posted by sscirrus on Stack Overflow See other posts from Stack Overflow or by sscirrus
Published on 2010-05-23T06:04:00Z Indexed on 2010/05/23 6:10 UTC
Read the original article Hit count: 316

Hi all,

I have set up AuthLogic almost exactly as per the AuthLogic example app at http://github.com/binarylogic/authlogic_example.

After someone logs in as User, they can click on links that send them away into the system and away from the users controller. This is an incredibly noob question, but how can I access that User's ID and other attributes from anywhere else, such as an unrelated view or unrelated controller?

An example of what I'd like to do:

#matchings controller
@matching = Matching.find_by_user_id(user.id)

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about variables