diff --git a/app/controllers/teacher_interface/reference_requests_controller.rb b/app/controllers/teacher_interface/reference_requests_controller.rb index a292c0d0f..facab93da 100644 --- a/app/controllers/teacher_interface/reference_requests_controller.rb +++ b/app/controllers/teacher_interface/reference_requests_controller.rb @@ -8,6 +8,8 @@ class ReferenceRequestsController < BaseController skip_before_action :authenticate_teacher! before_action :load_requested_reference_request, except: :show + rescue_from ActiveRecord::RecordNotFound, with: :error_not_found + define_history_origin :show define_history_reset :show define_history_check :edit @@ -25,6 +27,10 @@ def show @work_history = reference_request.work_history end + def error_not_found + render "error_not_found", status: :not_found + end + def edit @work_history = reference_request.work_history end diff --git a/app/services/update_work_history_contact.rb b/app/services/update_work_history_contact.rb index dfe46a48b..996ace773 100644 --- a/app/services/update_work_history_contact.rb +++ b/app/services/update_work_history_contact.rb @@ -30,6 +30,8 @@ def call end if email.present? && (reference_request = work_history.reference_request) + reference_request.regenerate_slug + RequestRequestable.call( requestable: reference_request, user:, diff --git a/app/views/teacher_interface/reference_requests/error_not_found.html.erb b/app/views/teacher_interface/reference_requests/error_not_found.html.erb new file mode 100644 index 000000000..2bc5e58c8 --- /dev/null +++ b/app/views/teacher_interface/reference_requests/error_not_found.html.erb @@ -0,0 +1,7 @@ +<% content_for :page_title, "We no longer need you to act as a reference." %> + +
We no longer need you to act as a reference.
+ +You do not need to do anything else.