From 24f85dd3e3f81cb4fc4c3f531b9ec06aac989116 Mon Sep 17 00:00:00 2001 From: BoHung Chiu Date: Wed, 5 Jul 2023 09:22:41 +0800 Subject: [PATCH 1/2] Fix bug for rails 4.2. --- .../app/controllers/custom_announcements_controller.rb | 5 ++++- .../app/controllers/custom_galleries_controller.rb | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/custom_announcement/app/controllers/custom_announcements_controller.rb b/custom_announcement/app/controllers/custom_announcements_controller.rb index b98a133..8b14d6e 100644 --- a/custom_announcement/app/controllers/custom_announcements_controller.rb +++ b/custom_announcement/app/controllers/custom_announcements_controller.rb @@ -98,7 +98,10 @@ class CustomAnnouncementsController < ApplicationController def self.custom_widget_data @custom_configs = CustomBulletinConfig.all.to_a ac = ActionController::Base.new - ac.render_to_string("custom_announcements/custom_widget_data",:locals=>{:@custom_data_field=>@custom_data_field,:@custom_configs=>@custom_configs,:@field_name=>@field_name}) + ac.instance_variable_set(:@custom_data_field, @custom_data_field) + ac.instance_variable_set(:@custom_configs, @custom_configs) + ac.instance_variable_set(:@field_name, @field_name) + ac.render_to_string("custom_announcements/custom_widget_data") end def random_custom_announcement_widget pack_data(true) diff --git a/custom_gallery/app/controllers/custom_galleries_controller.rb b/custom_gallery/app/controllers/custom_galleries_controller.rb index d4b0f7f..64ea006 100644 --- a/custom_gallery/app/controllers/custom_galleries_controller.rb +++ b/custom_gallery/app/controllers/custom_galleries_controller.rb @@ -133,7 +133,10 @@ class CustomGalleriesController < ApplicationController def self.custom_widget_data @custom_configs = CustomAlbumConfig.all.to_a ac = ActionController::Base.new - ac.render_to_string("custom_galleries/custom_widget_data",:locals=>{:@custom_data_field=>@custom_data_field,:@custom_configs=>@custom_configs,:@field_name=>@field_name}) + ac.instance_variable_set(:@custom_data_field, @custom_data_field) + ac.instance_variable_set(:@custom_configs, @custom_configs) + ac.instance_variable_set(:@field_name, @field_name) + ac.render_to_string("custom_galleries/custom_widget_data") end def custom_album_widget @custom_album_setting = CustomAlbumSetting.first -- 2.40.1 From 639fdd888c7ecd88cada18f5f6c3625971142750 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B1=E5=8D=9A=E4=BA=9E?= Date: Wed, 27 Sep 2023 17:07:44 +0800 Subject: [PATCH 2/2] fix delete error --- app/models/seminar_signup.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/seminar_signup.rb b/app/models/seminar_signup.rb index 91aef93..fefd159 100644 --- a/app/models/seminar_signup.rb +++ b/app/models/seminar_signup.rb @@ -69,6 +69,7 @@ class SeminarSignup sr.save end end + seminar_main.seminar_signups.delete(self) #avoid resave if seminar_main.unassigned_seminar_signup_ids.delete(id) seminar_main.save end -- 2.40.1