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

Fix undefined variable error in controller helper #25

Merged
merged 1 commit into from
Aug 7, 2023

Conversation

k-p-jones
Copy link
Contributor

Within lib/devise/api/controllers/helpers.rb the resource_class is being passed into Devise::Api::Responses::ErrorResponse on initialization. resource_class is a method inherited from the devise controllers so unfortunately, if we use authenticate_devise_api_token! in any controller that doesn't inherit from one, the gem will throw for blank, expired and revoked tokens, rather than handling it cleanly and returning the proper error.

I've added what I think is a clean fix for the issue, and some accompanying specs. I'm happy to make any tweaks if needed :)

This issue was initially raised here #24 (comment)

@nejdetkadir nejdetkadir merged commit e165ee0 into nejdetkadir:main Aug 7, 2023
@k-p-jones k-p-jones deleted the undefined-method-error branch August 7, 2023 13:35
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 this pull request may close these issues.

2 participants