We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6ca5e7f commit 5543b05Copy full SHA for 5543b05
app/controllers/volunteers_controller.rb
@@ -32,7 +32,16 @@ def create
32
authorize @volunteer
33
34
if @volunteer.save && @volunteer.email.match?(URI::MailTo::EMAIL_REGEXP)
35
- @volunteer.invite!(current_user)
+
36
+ # invitation error handling
37
+ begin
38
+ @volunteer.invite!(current_user)
39
+ rescue ActiveRecord::RecordInvalid, StandardError => e
40
+ logger.error "Volunteer invitation failed: #{e.message}"
41
+ else
42
+ logger.info "Volunteer invitation sent successfully"
43
+ end
44
45
# call short io api here
46
invitation_url = Rails.application.routes.url_helpers.accept_user_invitation_url(invitation_token: @volunteer.raw_invitation_token, host: request.base_url)
47
0 commit comments