How do I Get the current user id in my controller using devise?
In my controller I have something like this:
def index
me = current_user
c = User.find(m
Replace current index action as below
def index
if current_user
@sheets = current_user.time_sheets
else
redirect_to new_user_session_path, notice: 'You are not logged in.'
end
end
If user is not logged in, i.e., current_user=nil then user would be redirected to login page with a flash message.