Skip to content

Instantly share code, notes, and snippets.

@perryqh
Created June 23, 2010 13:50
Show Gist options
  • Save perryqh/449935 to your computer and use it in GitHub Desktop.
Save perryqh/449935 to your computer and use it in GitHub Desktop.
module DelayedJobExtensions
def delay_email_methods(*delay_me)
klass = (class << self; self end)
delay_me.each do |attr|
klass.send(:define_method, "delay_#{attr.to_s}".to_sym) do |*args|
if USE_DELAYED_JOB
self.delay.send("deliver_#{attr.to_s}".to_sym, *args)
else
self.send("deliver_#{attr.to_s}".to_sym, *args)
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment