From b409997d0fc03e05af61017a0dea290dcac71cb1 Mon Sep 17 00:00:00 2001 From: Maicol Bentancor Date: Sun, 21 Jun 2020 21:53:29 -0300 Subject: [PATCH] Avoid failing on undefined variable for invalid record (#1416) --- app/controllers/devise_token_auth/concerns/set_user_by_token.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/devise_token_auth/concerns/set_user_by_token.rb b/app/controllers/devise_token_auth/concerns/set_user_by_token.rb index 52d3c1d00..e28ef153c 100644 --- a/app/controllers/devise_token_auth/concerns/set_user_by_token.rb +++ b/app/controllers/devise_token_auth/concerns/set_user_by_token.rb @@ -103,7 +103,7 @@ def update_auth_header else unless @resource.reload.valid? - @resource = resource_class.find(@resource.to_param) # errors remain after reload + @resource = @resource.class.find(@resource.to_param) # errors remain after reload # if we left the model in a bad state, something is wrong in our app unless @resource.valid? raise DeviseTokenAuth::Errors::InvalidModel, "Cannot set auth token in invalid model. Errors: #{@resource.errors.full_messages}"