Class: NotifyUser::NotificationMailer

Inherits:
ActionMailer::Base
  • Object
show all
Defined in:
app/mailers/notify_user/notification_mailer.rb

Instance Method Summary collapse

Instance Method Details

#aggregate_notifications_email(notifications, options) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'app/mailers/notify_user/notification_mailer.rb', line 17

def aggregate_notifications_email(notifications, options)
  @notifications = notifications
  @notification = notifications.first

  mail to: @notifications.first.target.email,
       template_name: "aggregate_notification",
       template_path: ["notify_user/#{notifications.first.class.name.underscore}/action_mailer", "notify_user/action_mailer"],
       subject: subject(@notification, options[:aggregate][:subject]),
       from: NotifyUser.mailer_sender
end

#notification_email(notification, options) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'app/mailers/notify_user/notification_mailer.rb', line 7

def notification_email(notification, options)
  @notification = notification

  mail to: notification.target.email,
       subject: subject(notification, options[:subject]),
       template_name: "notification",
       template_path: "notify_user/action_mailer",
       from: NotifyUser.mailer_sender
end

#subject(notification, subject) ⇒ Object



28
29
30
# File 'app/mailers/notify_user/notification_mailer.rb', line 28

def subject(notification, subject)
  subject % notification.params.symbolize_keys
end