Created
October 17, 2011 13:10
-
-
Save danmcclain/1292570 to your computer and use it in GitHub Desktop.
Devise + Delayed_job
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Devise.setup do |config| | |
#... | |
config.mailer = "PasswordResetMailer" | |
#... | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PasswordResetJob < Struct.new(:id) | |
def perform | |
user = User.find(id) | |
Devise::Mailer.reset_password_instructions(user).deliver | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PasswordResetMailer < Devise::Mailer | |
def reset_password_instructions(record) | |
Delayed::Job.enqueue PasswordResetJob.new(record.id) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment