Rails + Devise + delayed_job?

后端 未结 9 2042
长情又很酷
长情又很酷 2020-12-24 07:38

I have a Rails 3 App using Devise on Heroku. Problem is I\'m sending emails with Sendgrid and email delivery is slow, it makes the app hang. So I\'m interested in using dela

9条回答
  •  一整个雨季
    2020-12-24 08:31

    I found that none of the above worked for me. I'm using Devise 2.0.4 and Rails 3.2.2 with delayed_job_active_record 0.3.2

    The way devise actually talks about doing something like this in the comments in the code is to override the methods in the User class. Thus, I solved it like so, and it works perfectly:

    app/models/User.rb

    def send_on_create_confirmation_instructions
      Devise::Mailer.delay.confirmation_instructions(self)
    end
    def send_reset_password_instructions
      Devise::Mailer.delay.reset_password_instructions(self)
    end
    def send_unlock_instructions
      Devise::Mailer.delay.unlock_instructions(self)
    end
    

提交回复
热议问题