Sha256: 03c4591aa29302d728e674cc69c111d72aa0cadb8853378e9295c46659267f8d
Contents?: true
Size: 811 Bytes
Versions: 3
Compression:
Stored size: 811 Bytes
Contents
class <%= class_name %> < ActiveRecord::Base serialize :tmail def self.queue(method, to, *args) method = method.to_s if method.is_a?(Symbol) [*to].each{|address| self.generate_mail(method, address, args)} end def self.deliver_all all.each{|m| m.deliver} end def to to = tmail.to.to_s to.blank? ? bcc : to end def bcc tmail.bcc.to_s end def from tmail.from.to_s end def deliver if <%= mailer_name %>.deliver(tmail) self.destroy else self.update_attributes({:attempts => self.attempts += 1, :last_attempt_at => Time.now}) end end private def self.generate_mail(method, address, args) create!(:mailer_method => method, :tmail => <%= mailer_name %>.send("create_#{method}".to_sym, address, *args)) end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
mdarby-mq-0.1.2 | generators/mq/templates/email.rb |
mq-0.1.3 | generators/mq/templates/email.rb |
mq-0.1.2 | generators/mq/templates/email.rb |