From f686a9376c24ca200f795b17879204b50de345c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Gaya?= <sebastien.gaya@gmail.com> Date: Thu, 6 Jan 2022 11:46:33 +0100 Subject: [PATCH] fix --- app/controllers/admin/education/schools_controller.rb | 6 +++--- app/views/admin/education/schools/_form.html.erb | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/admin/education/schools_controller.rb b/app/controllers/admin/education/schools_controller.rb index 8150ea41a..e1368257c 100644 --- a/app/controllers/admin/education/schools_controller.rb +++ b/app/controllers/admin/education/schools_controller.rb @@ -22,7 +22,7 @@ class Admin::Education::SchoolsController < Admin::Education::ApplicationControl def create @school.university = current_university - if @school.save + if @school.save_and_sync redirect_to [:admin, @school], notice: t('admin.successfully_created_html', model: @school.to_s) else breadcrumb @@ -31,7 +31,7 @@ class Admin::Education::SchoolsController < Admin::Education::ApplicationControl end def update - if @school.update(school_params) + if @school.update_and_sync(school_params) redirect_to [:admin, @school], notice: t('admin.successfully_updated_html', model: @school.to_s) else breadcrumb @@ -41,7 +41,7 @@ class Admin::Education::SchoolsController < Admin::Education::ApplicationControl end def destroy - @school.destroy + @school.destroy_and_sync redirect_to admin_university_schools_url, notice: t('admin.successfully_destroyed_html', model: @school.to_s) end diff --git a/app/views/admin/education/schools/_form.html.erb b/app/views/admin/education/schools/_form.html.erb index 87c4e36d4..8b449512a 100644 --- a/app/views/admin/education/schools/_form.html.erb +++ b/app/views/admin/education/schools/_form.html.erb @@ -29,9 +29,9 @@ <div class="card-body"> <%= f.association :programs, as: :check_boxes, - collection: collection_tree(current_university.education_programs, + collection: collection_tree(current_university.education_programs), label_method: ->(p) { sanitize p[:label] }, - value_method: ->(p) { p[:id] } %> + value_method: ->(p) { p[:id] } %> </div> </div> </div> -- GitLab