Sha256: 4f194e388b350fbf38012ca515aa477fe9961a02efbcb25e610142e4230decb7
Contents?: true
Size: 939 Bytes
Versions: 2
Compression:
Stored size: 939 Bytes
Contents
class Administration < ActiveRecord::Base def self.send_daily_digest digest_is_needed = false @yesterdays_contact_messages = Contact.yesterdays.chronologically @pending_comments = Comment.pending.by_created digest_is_needed = true if @yesterdays_contact_messages.count > 0 || @pending_comments.count > 0 if digest_is_needed User.administrators.each do |administrator| send_message_to_admin(administrator) end end end private def self.send_message_to_admin(recipient) # Actually send the email to the administrator begin AdministrationMailer.daily_digest( recipient, @yesterdays_contact_messages, @pending_comments ).deliver_now return 'success' rescue Exception => e AdminMailer.rescued_exceptions(e, "Some exception occurred while trying to send to site admin the daily digest.").deliver @exception = e return 'exception' end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tkh_mailing_list-0.11.3 | app/models/administration.rb |
tkh_mailing_list-0.11.2 | app/models/administration.rb |