From d89e977c440ad1742e23c6b9877fc0dc151ef513 Mon Sep 17 00:00:00 2001 From: Daniel Dye Date: Fri, 22 Nov 2024 13:14:37 +0000 Subject: [PATCH] Update program type before save is committed `after_save :update_program_type!` sets the program type after the record has been saved to the database. This doesn't update the database record unless it is saved again. --- app/models/course.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/course.rb b/app/models/course.rb index f83063c481..e790b98c55 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -116,7 +116,7 @@ class Course < ApplicationRecord after_validation :remove_unnecessary_enrichments_validation_message before_save :set_applications_open_from - after_save :update_program_type!, if: :saved_change_to_funding? + before_save :update_program_type!, if: :will_save_change_to_funding? belongs_to :provider