Sha256: 0ab3f8c2723e1844afcdbc84ca0a5fd11efe0c69bac67a0f8b73ee3bd703440b

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 KB

Contents

module QuoVadis
  class Notifier < ActionMailer::Base

    # Sends an email to <tt>user</tt> with a link to a page where they
    # can change their password.
    def change_password(user)
      @username = user.username
      @url = change_password_url user.token
      mail :to => user.email, :from => QuoVadis.from, :subject => I18n.t('quo_vadis.notifier.change_password.subject')
    end

    # Sends an email to <tt>user</tt> 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`.
    def invite(user, data = {})
      @user = user
      @url = invitation_url user.token
      
      from    = data.delete(:from)    || QuoVadis.from
      subject = data.delete(:subject) || I18n.t('quo_vadis.notifier.invite.subject')

      data.each { |k,v| instance_variable_set :"@#{k}", v }
      mail :to => user.email, :from => from, :subject => subject
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
quo_vadis-1.4.2 app/mailers/quo_vadis/notifier.rb
quo_vadis-1.4.1 app/mailers/quo_vadis/notifier.rb
quo_vadis-1.4.0 app/mailers/quo_vadis/notifier.rb