From b750041b72611023a489d2a3cebebe2602b5c96b Mon Sep 17 00:00:00 2001 From: Martin Artnik Date: Fri, 7 Jun 2024 12:00:56 +0200 Subject: [PATCH] Optimize and fix serializer for tag updates on canvas [SCI-10687] --- app/controllers/my_modules_controller.rb | 2 +- app/serializers/lists/my_module_serializer.rb | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/my_modules_controller.rb b/app/controllers/my_modules_controller.rb index d0cfb854c..7764d6c4e 100644 --- a/app/controllers/my_modules_controller.rb +++ b/app/controllers/my_modules_controller.rb @@ -99,7 +99,7 @@ class MyModulesController < ApplicationController } end format.json do - render json: @my_module, serializer: Lists::MyModuleSerializer, user: current_user + render json: @my_module, serializer: Lists::MyModuleSerializer, controller: self, user: current_user end end end diff --git a/app/serializers/lists/my_module_serializer.rb b/app/serializers/lists/my_module_serializer.rb index 36425ab67..b48ba5648 100644 --- a/app/serializers/lists/my_module_serializer.rb +++ b/app/serializers/lists/my_module_serializer.rb @@ -145,7 +145,9 @@ module Lists def tags_html # legacy canvas support - ApplicationController.new.render_to_string( + return '' unless @instance_options[:controller] + + @instance_options[:controller].render_to_string( partial: 'canvas/tags', locals: { my_module: object }, formats: :html