Skip to content

Instantly share code, notes, and snippets.

@NZKoz
Forked from nikz/gist:608899
Created October 3, 2010 20:32
Show Gist options
  • Save NZKoz/608901 to your computer and use it in GitHub Desktop.
Save NZKoz/608901 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, *deserialize(args)).deliver!
end
end
cattr_accessor :perform_delayed
@@perform_delayed = false
class << self
def method_missing(name, *args)
args = Job.serialize(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