From 91bc114f32a94e92183bbe36a724c37ca8e7f961 Mon Sep 17 00:00:00 2001
From: Stan Hu <stanhu@gmail.com>
Date: Tue, 3 Nov 2020 14:11:59 -0800
Subject: [PATCH] Make Rails code reloading configurable in development

For many frontend developers, code reloading is unnecessary and creates
more problems than it solves.

This commit adds a CACHE_CLASSES environment variable that can be
defined to disable code reloading. We do this as an environment variable
because this variable is most conveniently defined in the
`development.rb` and isn't needed in production.

Relates to
https://gitlab.com/gitlab-org/gitlab-development-kit/-/issues/794
---
 config/environments/development.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/config/environments/development.rb b/config/environments/development.rb
index 9d4fc6ba5e976..31a3af77ba1df 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -4,7 +4,7 @@
   # In the development environment your application's code is reloaded on
   # every request. This slows down response time but is perfect for development
   # since you don't have to restart the web server when you make code changes.
-  config.cache_classes = false
+  config.cache_classes = Gitlab::Utils.to_boolean(ENV['CACHE_CLASSES'], default: false)
 
   # Show full error reports and disable caching
   config.active_record.verbose_query_logs  = true
-- 
GitLab