Class: NotificationMailers::Base

Inherits:
Object
  • Object
show all
Defined in:
app/mailers/notification_mailers/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(recipient_id, sender_id = nil, *args) ⇒ Base


9
10
11
12
13
14
15
16
17
18
19
# File 'app/mailers/notification_mailers/base.rb', line 9

def initialize(recipient_id, sender_id=nil, *args)
  @headers = {}
  @recipient = User.find_by_id(recipient_id)
  @sender = Person.find_by_id(sender_id) if sender_id.present?

  log_mail(recipient_id, sender_id, self.class.to_s.underscore)

  with_recipient_locale do
    set_headers(*args)
  end
end

Instance Attribute Details

#recipientObject

Returns the value of attribute recipient


3
4
5
# File 'app/mailers/notification_mailers/base.rb', line 3

def recipient
  @recipient
end

#senderObject

Returns the value of attribute sender


3
4
5
# File 'app/mailers/notification_mailers/base.rb', line 3

def sender
  @sender
end

Instance Method Details

#headersObject


21
22
23
# File 'app/mailers/notification_mailers/base.rb', line 21

def headers
  default_headers.merge(@headers)
end

#name_and_address(name, email) ⇒ Object


25
26
27
28
29
# File 'app/mailers/notification_mailers/base.rb', line 25

def name_and_address(name, email)
  address = Mail::Address.new email
  address.display_name = name
  address.format
end