Method: EffectiveDeviseUser#send_devise_notification

Defined in:
app/models/concerns/effective_devise_user.rb

#send_devise_notification(notification, *args) ⇒ Object

Send devise & devise_invitable emails via active job



155
156
157
158
159
160
161
162
163
164
165
166
# File 'app/models/concerns/effective_devise_user.rb', line 155

def send_devise_notification(notification, *args)
  raise('expected args Hash') unless args.respond_to?(:last) && args.last.kind_of?(Hash)

  if defined?(Tenant)
    tenant = Tenant.current || raise('expected a current tenant')
    args.last[:tenant] ||= tenant
  end

  wait = (5 if notification == :invitation_instructions && !Rails.env.test?)

  devise_mailer.send(notification, self, *args).deliver_later(wait: wait)
end