From 24f85dd3e3f81cb4fc4c3f531b9ec06aac989116 Mon Sep 17 00:00:00 2001 From: BoHung Chiu Date: Wed, 5 Jul 2023 09:22:41 +0800 Subject: [PATCH] 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