Class: MessageMailer

Inherits:
ActionMailer::Base
  • Object
show all
Defined in:
lib/generators/kitestrings/message_templates/message_mailer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#subjectObject (readonly)

Returns the value of attribute subject.



5
6
7
# File 'lib/generators/kitestrings/message_templates/message_mailer.rb', line 5

def subject
  @subject
end

Instance Method Details

#prepare_message(message) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/generators/kitestrings/message_templates/message_mailer.rb', line 7

def prepare_message(message)
  @message = message
  @user = message.user

  # ask the message model if we need any attachments added
  message.add_attachments(self)

  m = mail(to: message.user.email, subject: message.subject, template_name: message.template || :default)
  # allow template to override subject in the view by doing: <% @message.subject = "new subject" %>
  m.subject = message.subject
  m
end