Class: UserJoinedMailer

Inherits:
ApplicationMailer show all
Defined in:
app/mailers/user_joined_mailer.rb

Instance Method Summary collapse

Instance Method Details

#user_joined(to, object, joiner) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/mailers/user_joined_mailer.rb', line 4

def user_joined(to, object, joiner)
  @joiner = joiner
  @object = object
  @object_type = object.class.name.casecmp('workgroup').zero? ? 'group' : object.class.name.downcase
  @to = to

  # Postmark metadatas
  ['user-id-to'] = to.id
  ['object-type'] = @object_type

  mail(
    to: "<#{to.email}>",
    from: "JOGL - Just One Giant Lab <notifications@#{Rails.configuration.email}>",
    subject: "A user joined your #{@object_type}",
    tag: 'user-joined'
  )
end