Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INFO: Doing something special when user is logged in #32

Open
vivek-pai opened this issue Apr 8, 2012 · 0 comments
Open

INFO: Doing something special when user is logged in #32

vivek-pai opened this issue Apr 8, 2012 · 0 comments
Labels

Comments

@vivek-pai
Copy link

This isn't really an "ISSUE" but I figured this would be the best way to push this info out to everyone...

If you want to incorporate the logged in user (current_user) into any logic:

1.) Within a view or a controller, you can call the function signed_in?, which will return true or false if the user is signed in or not. You can use this to toggle parts of an html page, for example.

2.) If the user is logged in (by 1.) ), then, within a controller or view, you can get info about the user using the user object current_user.
A user object has a name, a first_name, a last_name, and a andrew_id

3.) current_user.can_moderate? returns true if the user is the moderator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant