Note that if the model that you're trying to access isn't called User, the helper method names will change. For example, if the user model is called Admin, the methods would look like this:
The above is explained above, but the following is actually more correct.
It is automatically generated from the namespace in which "mount_devise_token_auth_for" is written and the model resource name.
This is because the following routing is "authenticate_admin_user!", not "authenticate_user!"
namespace :admin do
mount_devise_token_auth_for 'User', at: 'auth', skip: [:omniauth_callbacks]
end
docs
https://devise-token-auth.gitbook.io/devise-token-auth/usage/controller_methods#methods
description
The above is explained above, but the following is actually more correct.
This is because the following routing is "authenticate_admin_user!", not "authenticate_user!"
I would be glad to know if I am wrong!🙇