Skip to content

Instantly share code, notes, and snippets.

@nikz
Created October 3, 2010 20:28
Show Gist options
  • Save nikz/608899 to your computer and use it in GitHub Desktop.
Save nikz/608899 to your computer and use it in GitHub Desktop.
# use me to deliver emails plz kthx
class Notifier
class Job
def self.perform(name, args)
NotifierMailer.send(name, *args).deliver!
end
end
cattr_accessor :perform_delayed
@@perform_delayed = false
class << self
def method_missing(name, *args)
if perform_delayed
Resque.enqueue(Job, name, args)
else
Job.perform(name, args)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment