无法自动加载常量 JWTBlacklist,预期 /home/sourabh/dev/celebration/app/m



my user.rb 模型包含:

class User < ApplicationRecord
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
:confirmable, :lockable, :timeoutable, :omniauthable,
:jwt_authenticatable, jwt_revocation_strategy: JWTBlacklist
def send_devise_notification(notification, *args)
devise_mailer.send(notification, self, *args).deliver_later
end
end

我正在使用 devise-jwt gem 来登录我的 rails api。

我的JWTBlacklist.rb模型包含:

class JwtBlacklist < ApplicationRecord
include Devise::JWT::RevocationStrategies::Blacklist
self.table_name = 'jwt_blacklist'
end

您的User类正在寻找JWTBlacklist,但您的文件正在定义JwtBlacklist。您需要更改其中一个以匹配另一个。

最新更新