jnstq (owner)

Revisions

gist: 171723 Download_button fork
public
Public Clone URL: git://gist.github.com/171723.git
Embed All Files: show embed
snippet.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Use backgrounded for ActionMailer delivery
# http://github.com/wireframe/backgrounded/tree/master
 
class Mailer < ActionMailer::Base
  class << self
    backgrounded :deliver
  end
  def signup_notifiation(user)
    ..
  end
end
 
 
# If you depend on custom attr_accessor in the user model, that are not stored in db render the mail in the current request.
mail = Mailer.create_signup_notification(user)
Mailer.deliver_backgrounded(mail)
 
# Equal to
JobFu::Job.add ProcessableMethod.new(Mailer, :deliver, mail)