0
votes

I have set up Devise Confirmable on my Rails app and have it all working fine, however when trying to set Devise emails to run in the background no emails are sent.

gem 'devise', '~> 4.3'
gem 'devise_invitable', '~> 1.7', '>= 1.7.2'
gem "sidekiq"

1) I have Redis and Sidekiq set up and running locally (they worked on a non devise welcome email).

2) I've added this into my User.rb model (devise docs - https://github.com/plataformatec/devise#activejob-integration)

def send_devise_notification(notification, *args)
  UserMailer.send(notification, self, *args).deliver_later
end

In the log it seems to trigger the Job but then nothing is sent.

[ActiveJob] Enqueued ActionMailer::DeliveryJob (Job ID: 01f432e9-e8cf-47fa-
b5ac-de936aa920d1) to Sidekiq(mailers) with arguments: "UserMailer", 
"confirmation_instructions", "deliver_now", #<GlobalID:0x007f86f539e198 @uri=#
<URI::GID gid://experiment-log-v1/User/78>>, "wYfrsX13ie5fAFWKV8tp", {}

I've also tried adding "mailers" to the sidekiq.yml

:queues:
 - default
 - mailers

Am I missing something in ActiveJob for this? If so what would I put in order to override all Devise emails?

1

1 Answers

2
votes

Silly mistake - I didn't realise but I'd added the send_devise_notification method below "private" in my User model. After moving it above it all worked fine.