Fix bug for rails 4.2.

This commit is contained in:
BoHung Chiu 2023-07-05 09:22:41 +08:00
parent be15c66f5a
commit 24f85dd3e3
2 changed files with 8 additions and 2 deletions

View File

@ -98,7 +98,10 @@ class CustomAnnouncementsController < ApplicationController
def self.custom_widget_data def self.custom_widget_data
@custom_configs = CustomBulletinConfig.all.to_a @custom_configs = CustomBulletinConfig.all.to_a
ac = ActionController::Base.new 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 end
def random_custom_announcement_widget def random_custom_announcement_widget
pack_data(true) pack_data(true)

View File

@ -133,7 +133,10 @@ class CustomGalleriesController < ApplicationController
def self.custom_widget_data def self.custom_widget_data
@custom_configs = CustomAlbumConfig.all.to_a @custom_configs = CustomAlbumConfig.all.to_a
ac = ActionController::Base.new 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 end
def custom_album_widget def custom_album_widget
@custom_album_setting = CustomAlbumSetting.first @custom_album_setting = CustomAlbumSetting.first