Skip to content

Instantly share code, notes, and snippets.

@AshikNesin
Created September 10, 2015 11:02
Show Gist options
  • Select an option

  • Save AshikNesin/5f4139f556e7fb812aea to your computer and use it in GitHub Desktop.

Select an option

Save AshikNesin/5f4139f556e7fb812aea to your computer and use it in GitHub Desktop.
[Rails 4] Get the current user email id in Devise
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