Class: SubscriptionMailer

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

Overview

Copyright © 2008-2013 Michael Dvorkin and contributors.

Fat Free CRM is freely distributable under the terms of MIT license. See MIT-LICENSE file or www.opensource.org/licenses/mit-license.php


Instance Method Summary collapse

Instance Method Details

#comment_notification(user, comment) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/mailers/subscription_mailer.rb', line 9

def comment_notification(user, comment)
  @entity = comment.commentable
  @entity_type = @entity.class.to_s
  @entity_name = @entity.respond_to?(:full_name) ? @entity.full_name : @entity.name

  @comment = comment
  @user = comment.user

  # If entity has tags, join them and wrap in parantheses
  subject = "RE: [#{@entity_type.downcase}:#{@entity.id}] #{@entity_name}"
  subject += " (#{@entity.tags.join(', ')})" if @entity.tags.any?

  mail subject: subject,
       to: user.email,
       from: from_address(@user),
       date: Time.now
end