Commit ba8deb78 authored by Kaspar Vollenweider's avatar Kaspar Vollenweider 👻 Committed by Kaspar
Browse files

small refactor of volunteer user creation

- code slimmer
- dont send invite_sent notification in case user creation and invitation fails
parent 5c2b5524
......@@ -45,11 +45,11 @@ class VolunteersController < ApplicationController
def invite_volunteer_user
new_user =,
password: Devise.friendly_token, role: 'volunteer')
@volunteer.user = new_user
new_user =
email:, password: Devise.friendly_token,
role: 'volunteer', volunteer: @volunteer
return unless && new_user.invite!
redirect_to volunteers_path, notice: t('invite_sent', email:
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment