From ca215d36da0d10c9edbbee234f5ed1cec081a507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Thu, 14 Feb 2019 09:00:32 +0100 Subject: [PATCH] Avoid warning spewing for api consts /home/oliver/openproject/dev/lib/api/v3/render/render_api.rb:39: warning: already initialized constant API::V3::Render::RenderAPI::SUPPORTED_CONTEXT_NAMESPACES /home/oliver/openproject/dev/lib/api/v3/render/render_api.rb:39: warning: previous definition of SUPPORTED_CONTEXT_NAMESPACES was here /home/oliver/openproject/dev/lib/api/v3/render/render_api.rb:40: warning: already initialized constant API::V3::Render::RenderAPI::SUPPORTED_MEDIA_TYPE /home/oliver/openproject/dev/lib/api/v3/render/render_api.rb:40: warning: previous definition of SUPPORTED_MEDIA_TYPE was here /home/oliver/openproject/dev/lib/api/v3/render/render_api.rb:39: warning: already initialized constant API::V3::Render::RenderAPI::SUPPORTED_CONTEXT_NAMESPACES /home/oliver/openproject/dev/lib/api/v3/render/render_api.rb:39: warning: previous definition of SUPPORTED_CONTEXT_NAMESPACES was here /home/oliver/openproject/dev/lib/api/v3/render/render_api.rb:40: warning: already initialized constant API::V3::Render::RenderAPI::SUPPORTED_MEDIA_TYPE /home/oliver/openproject/dev/lib/api/v3/render/render_api.rb:40: warning: previous definition of SUPPORTED_MEDIA_TYPE was here --- lib/api/v3/render/render_api.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/api/v3/render/render_api.rb b/lib/api/v3/render/render_api.rb index 6f7cf5ffe7..705f288a6c 100644 --- a/lib/api/v3/render/render_api.rb +++ b/lib/api/v3/render/render_api.rb @@ -36,8 +36,8 @@ module API resources :render do helpers do - SUPPORTED_CONTEXT_NAMESPACES = %w(work_packages projects news posts wiki_pages).freeze - SUPPORTED_MEDIA_TYPE = 'text/plain'.freeze + SUPPORTED_CONTEXT_NAMESPACES ||= %w(work_packages projects news posts wiki_pages).freeze + SUPPORTED_MEDIA_TYPE ||= 'text/plain'.freeze def allowed_content_types [SUPPORTED_MEDIA_TYPE]