Browse Source

Maintenance: Use enable_reloading rather than deprecated cache_classes

Martin Gruner 3 months ago
parent
commit
050bb8d7d4

+ 1 - 1
config/environments/development.rb

@@ -6,7 +6,7 @@ Rails.application.configure do
   # 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.enable_reloading = true
 
   # Do not eager load code on boot.
   config.eager_load = false

+ 1 - 1
config/environments/production.rb

@@ -17,7 +17,7 @@ Rails.application.configure do
   # Settings specified here will take precedence over those in config/application.rb.
 
   # Code is not reloaded between requests.
-  config.cache_classes = true
+  config.enable_reloading = false
 
   # Eager load code on boot. This eager loads most of Rails and
   # your application in memory, allowing both threaded web servers

+ 1 - 1
config/environments/test.rb

@@ -7,7 +7,7 @@ Rails.application.configure do
   # test suite. You never need to work with it otherwise. Remember that
   # your test database is "scratch space" for the test suite and is wiped
   # and recreated between test runs. Don't rely on the data there!
-  config.cache_classes = true
+  config.enable_reloading = false
 
   # Do not eager load code on boot. This avoids loading your whole application
   # just for the purpose of running a single test. If you are using a tool that

+ 3 - 3
config/routes.rb

@@ -16,10 +16,10 @@ Rails.application.routes.draw do
   dir = File.expand_path(__dir__)
   files = Dir.glob("#{dir}/routes/*.rb")
   files.each do |file|
-    if Rails.configuration.cache_classes
-      require_dependency file
-    else
+    if Rails.configuration.enable_reloading
       load file
+    else
+      require_dependency file
     end
   end