Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined local variable or method `resource_name' #1352

Closed
ipepe opened this issue Nov 4, 2019 · 1 comment · Fixed by #1416
Closed

undefined local variable or method `resource_name' #1352

ipepe opened this issue Nov 4, 2019 · 1 comment · Fixed by #1416

Comments

@ipepe
Copy link

ipepe commented Nov 4, 2019

  • Version: 1.1.2
  • Request and response headers: no need
  • Rails Stacktrace:
NameError (undefined local variable or method `resource_name' for #<Api::V1::Controller:0x00007fd1be55ed70>
Did you mean?  resource_class):
  
devise_token_auth (1.1.2) app/controllers/devise_token_auth/concerns/resource_finder.rb:35:in `resource_class'
devise_token_auth (1.1.2) app/controllers/devise_token_auth/concerns/set_user_by_token.rb:106:in `update_auth_header'
  • Environmental Info: User record was invalid straight from database because of wrong validation.

When record is invalid straight from database, then error should be more descriptive. This stacktrace does not say what is the problem.

I fixed validations and records are now valid and everything is working flawlessly but neverless it would be nice for devise_token_auth to raise communicative errors.

@nalbeza
Copy link

nalbeza commented Nov 20, 2019

I'm having the same issue, it can be triggered with an invalid password_confirmation for example.
Maybe using @resource.class instead of resource_class() would be a good way to fix the issue ?
I added a resource_name method to my controller in the meantime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants