Class: DigestNotifier::DigestMailer

Inherits:
ActionMailer::Base
  • Object
show all
Defined in:
lib/app/mailer/digest_mailer.rb

Instance Method Summary collapse

Instance Method Details

#digest_group_notification(receiver_email, digest_group) ⇒ Object

Used to send digest email for a single digest_group



13
14
15
# File 'lib/app/mailer/digest_mailer.rb', line 13

def digest_group_notification(receiver_email, digest_group)
  @digest_items = DigestEmailItem.joins(:digest_email_deliveries).where("digest_email_deliveries.receiver_email = ?", receiver_email).group(:digest_email_group_id)
end

#digest_notification(receiver_email, digest_items) ⇒ Object



5
6
7
8
9
10
# File 'lib/app/mailer/digest_mailer.rb', line 5

def digest_notification(receiver_email, digest_items)
  @digest_items  = digest_items
  @digest_groups = @digest_items.group(:digest_email_group_id).map &:digest_email_group
   
  mail :to => receiver_email, :subject => digest_email_subject, :from => DigestNotifier.mailer_sender
end