Last active
September 28, 2015 03:18
-
-
Save teeparham/1375726 to your computer and use it in GitHub Desktop.
Devise Resque Mailer
This file contains hidden or 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
module Resque | |
module Mailer | |
class MessageDecoy | |
def deliver | |
record = @args.first | |
resque.enqueue @mailer_class, @method_name, record.class.name, record.id | |
end | |
end | |
end | |
end | |
class DeviseResqueMailer < Devise::Mailer | |
include Resque::Mailer | |
def self.perform(action, class_name, id) | |
record = class_name.constantize.find(id) | |
self.send(:new, action, record).message.deliver | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment