请教各种大牛,当调用 send_password_reset_email 时,sidekiq 始终出现错误。
class User < ApplicationRecord
# 发送重置密码邮件
def send_password_reset_email
EmailWorkerJob.perform_later(self)
end
end
#Job
class EmailWorkerJob < ApplicationJob
queue_as :default
def perform(user)
UserMailer.password_reset(user).deliver_now
end
end
#Mailer
class UserMailer < ApplicationMailer
def password_reset(user)
@user = user
mail to: @user.email, subject: "密码重置"
end
end