class UserNotif::NotifMailer

Public Instance Methods

notif_email(notif_id) click to toggle source
# File lib/user_notif/notif_mailer.rb, line 5
def notif_email(notif_id)
  notif = Notif.find(notif_id)
  @target = notif.target
  @user = notif.user
  send_email({
    to: @user.email,
    template_path: 'notifs/mailer',
    template_name: notif.template_name
  }.merge(notif.email_options))
end

Private Instance Methods

send_email(opts) click to toggle source
# File lib/user_notif/notif_mailer.rb, line 18
def send_email(opts)
  (opts.delete(:attachments) || []).each { |k| attachments[k[0]] = k[1] }
  mail(opts)
end