Created
September 10, 2015 11:02
-
-
Save AshikNesin/5f4139f556e7fb812aea to your computer and use it in GitHub Desktop.
[Rails 4] Get the current user email id in Devise
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ControllerName < ApplicationController | |
| def index | |
| if current_user | |
| @email = current_user.email | |
| else | |
| redirect_to new_user_session_path, notice: 'You are not logged in.' | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment