Class: CodeSender

Inherits:
ApplicationMailer
  • Object
show all
Defined in:
app/mailers/code_sender.rb

Overview

Mailer for sending codes to users

Instance Method Summary collapse

Instance Method Details

#email(code_id) ⇒ Object

Email confirmation code

Parameters:

  • code_id (Integer)


8
9
10
11
12
13
14
15
16
17
# File 'app/mailers/code_sender.rb', line 8

def email(code_id)
  @code = Code.find_by(id: code_id)
  return if @code.nil?

  user = @code.user

  return if user.email.blank? || user.email_confirmed?

  mail to: user.email
end

#password(code_id) ⇒ Object

Password reset code

Parameters:

  • code_id (Integer)


22
23
24
25
26
27
28
# File 'app/mailers/code_sender.rb', line 22

def password(code_id)
  @code = Code.find_by(id: code_id)

  return if @code.nil? || @code.user.email.blank?

  mail to: @code.user.email
end