Skip to content

Instantly share code, notes, and snippets.

@danmcclain
Created October 17, 2011 13:10
Show Gist options
  • Save danmcclain/1292570 to your computer and use it in GitHub Desktop.
Save danmcclain/1292570 to your computer and use it in GitHub Desktop.
Devise + Delayed_job
Devise.setup do |config|
#...
config.mailer = "PasswordResetMailer"
#...
end
class PasswordResetJob < Struct.new(:id)
def perform
user = User.find(id)
Devise::Mailer.reset_password_instructions(user).deliver
end
end
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