File obs-server-2.10-0122-Address-deprecation-warning-on-render_xml.patch of Package obs-server

From b8cc69fe5a5aff516606238ec945f99cdbbf631b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Saray=20Cabrera=20Padr=C3=B3n?= <scabrerapadron@suse.de>
Date: Mon, 15 Jun 2020 10:32:10 +0200
Subject: [PATCH] Address deprecation warning on render_xml

Message:

"DEPRECATION WARNING: ActionView::Base instances must implement
compiled_method_container or use the class method
with_empty_template_cache for constructing an ActionView::Base instance
that has an empty cache. (called from render_xml at
/srv/www/obs/api/app/mixins/can_render_model.rb:8)"

Co-authored-by: Victor Pereira <vpereira@suse.com>
---
 src/api/app/mixins/can_render_model.rb | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/api/app/mixins/can_render_model.rb b/src/api/app/mixins/can_render_model.rb
index ffc94223d1..de99773b4d 100644
--- a/src/api/app/mixins/can_render_model.rb
+++ b/src/api/app/mixins/can_render_model.rb
@@ -3,9 +3,7 @@
 # and use my_model to access the model instead of self
 module CanRenderModel
   def render_xml(locals = {})
-    action_view = ActionView::Base.new(Rails.configuration.paths['app/views'].to_ary)
     locals[:my_model] = self
-    action_view.render partial: "models/#{self.class.name.underscore}", formats: [:xml],
-                       locals: locals
+    ApplicationController.render(partial: "models/#{self.class.name.underscore}", locals: locals, formats: [:xml])
   end
 end
-- 
2.31.1