Class: EmailNotify

Inherits:
Object
  • Object
show all
Defined in:
lib/email_notify.rb

Overview

TODO: Use deliver_later to avoid slowness and errors

Class Method Summary collapse

Class Method Details

.loggerObject



5
6
7
# File 'lib/email_notify.rb', line 5

def self.logger
  @@logger ||= ::Rails.logger || Logger.new($stdout)
end

.send_article(article, user) ⇒ Object



16
17
18
19
20
21
# File 'lib/email_notify.rb', line 16

def self.send_article(article, user)
  return if user.email.blank?

  email = NotificationMailer.article(article, user)
  email.deliver_now
end

.send_comment(comment, user) ⇒ Object



9
10
11
12
13
14
# File 'lib/email_notify.rb', line 9

def self.send_comment(comment, user)
  return if user.email.blank?

  email = NotificationMailer.comment(comment, user)
  email.deliver_now
end

.send_user_create_notification(user) ⇒ Object

Send a welcome mail to the user created



24
25
26
27
# File 'lib/email_notify.rb', line 24

def self.send_user_create_notification(user)
  email = NotificationMailer.notif_user(user)
  email.deliver_now
end