Class: EmailMessage
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- EmailMessage
- Defined in:
- app/models/email_message.rb
Class Method Summary collapse
Instance Method Summary collapse
- #deliver! ⇒ Object
-
#deliver_now ⇒ Object
TODO: Take this out when we have an email queue processor.
- #delivered? ⇒ Boolean
Class Method Details
.deliver! ⇒ Object
13 14 15 16 17 18 |
# File 'app/models/email_message.rb', line 13 def self.deliver! # Send all messages, 100 at a time undelivered.all(:limit => 100).each do |m| m.deliver! end end |
Instance Method Details
#deliver! ⇒ Object
25 26 27 28 29 |
# File 'app/models/email_message.rb', line 25 def deliver! return false if delivered? EmailMessageMailer.(self) update_attributes(:delivered_at => Time.now) end |
#deliver_now ⇒ Object
TODO: Take this out when we have an email queue processor
21 22 23 |
# File 'app/models/email_message.rb', line 21 def deliver_now deliver! end |
#delivered? ⇒ Boolean
9 10 11 |
# File 'app/models/email_message.rb', line 9 def delivered? !!delivered_at end |