Class: QuoVadis::Notifier

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

Instance Method Summary collapse

Instance Method Details

#change_password(user) ⇒ Object

Sends an email to user with a link to a page where they can change their password.



6
7
8
9
10
# File 'app/mailers/quo_vadis/notifier.rb', line 6

def change_password(user)
  @username = user.username
  @url = change_password_url user.token
  mail :to => user.email, :from => QuoVadis.from, :subject => QuoVadis.subject_change_password
end

#invite(user, data = {}) ⇒ Object

Sends an email to user with a link to a page where they can choose their username and password.

‘data` - hash of data to pass to view via instance variables. A key of `:foo`

will be available via `@foo`.  `:from` and `:subject` are deleted from
the hash and used to override `QuoVadis#from` and `#subject_invitation`.


18
19
20
21
22
23
24
25
26
27
# File 'app/mailers/quo_vadis/notifier.rb', line 18

def invite(user, data = {})
  @user = user
  @url = invitation_url user.token
  
  from    = data.delete(:from)    || QuoVadis.from
  subject = data.delete(:subject) || QuoVadis.subject_invitation
  
  data.each { |k,v| instance_variable_set :"@#{k}", v }
  mail :to => user.email, :from => from, :subject => subject
end