Skip to content

Instantly share code, notes, and snippets.

@rbazinet
Forked from scottwater/email_queue.rb
Created February 17, 2012 19:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rbazinet/1855001 to your computer and use it in GitHub Desktop.
Save rbazinet/1855001 to your computer and use it in GitHub Desktop.
EmailQueue for Sidekiq
class EmailQueue
include Sidekiq::Worker
def perform(options)
mailer = options['mailer'].constantize
method = options['method']
args = options['args']
mailer.send(method, *args).deliver
end
def self.enqueue(mailer_klass, method, *args)
options = {'mailer' => mailer_klass.to_s, 'method' => method, 'args' => args}
self.perform_async(options)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment