devise icon indicating copy to clipboard operation
devise copied to clipboard

current_user - wrong number of arguments (given 0, expected 1)

Open pwgustafson opened this issue 10 years ago • 2 comments

I recently created a new rails app, and decided to use Devise 4.2. In the past I have used version 3, and used to be able to do things like current_user.inspect for debugging and logging.

When I try that now on Devise 4.2, I get the following error:

wrong number of arguments (given 0, expected 1)

Am I doing something wrong? or did something change in those regards?

Thanks in advance!

pwgustafson avatar Nov 08 '16 22:11 pwgustafson

Never mind, I was originally using a custom user auth, with a password_digest. When I switched to devise, I forgot to remove that from my users model. Once I did that this error was resolved.

Not quite sure what the conflict was, but will close this issue now.

Thanks again!

pwgustafson avatar Nov 10 '16 00:11 pwgustafson

@pwgustafson thanks for your follow up post explaining how you fixed your problem. I had the same issue, was using a User class that I rolled myself until I switched to Devise. After removing the 'password digest' field I was able to query the user model without the error.

jaykilleen avatar Sep 23 '19 09:09 jaykilleen