Issue retrieving current_user in Devise with different model name-Collection of common programming errors

I have got Devise setup in my rails app with my model called auth_user instead of user. I have tried accessing the currently logged in user’s email address (a field called email) for me to use in a query against an Employee model like so

@employee = Employee.find_by_Email(

but get the error:

undefined method `email' for nil:NilClass

Any ideas on how to resolve this issue?



** EDIT **

Fix as suggested by @theButler in the comments. Resolution was to add

before_filter :authenticate_auth_user!

To the top of the class.

Originally posted 2013-11-09 21:06:45.