From 44329e48934263dc3900d8baf2590757b9cab0ae Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Gaya?= <sebastien.gaya@gmail.com>
Date: Thu, 16 Mar 2023 15:31:59 +0100
Subject: [PATCH] hotfix school

---
 app/controllers/admin/education/schools_controller.rb | 2 +-
 app/models/education/school/with_alumni.rb            | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/app/controllers/admin/education/schools_controller.rb b/app/controllers/admin/education/schools_controller.rb
index f3322b1f8..93593ffc8 100644
--- a/app/controllers/admin/education/schools_controller.rb
+++ b/app/controllers/admin/education/schools_controller.rb
@@ -47,7 +47,7 @@ class Admin::Education::SchoolsController < Admin::Education::ApplicationControl
 
   def destroy
     @school.destroy_and_sync
-    redirect_to admin_university_schools_url, notice: t('admin.successfully_destroyed_html', model: @school.to_s)
+    redirect_to admin_education_schools_url, notice: t('admin.successfully_destroyed_html', model: @school.to_s)
   end
 
   private
diff --git a/app/models/education/school/with_alumni.rb b/app/models/education/school/with_alumni.rb
index 976721f5c..3a55dadd7 100644
--- a/app/models/education/school/with_alumni.rb
+++ b/app/models/education/school/with_alumni.rb
@@ -4,7 +4,8 @@ module Education::School::WithAlumni
   included do
 
       has_many    :education_cohorts,
-                  class_name: 'Education::Cohort'
+                  class_name: 'Education::Cohort',
+                  dependent: :destroy
                   alias_attribute :cohorts, :education_cohorts
 
       has_many    :alumni, -> { distinct },
-- 
GitLab