Skip to content

Commit c05fcc7

Browse files
authored
Merge pull request rails#44870 from rails/config.reload
Define config.reload to be !config.cache_classes
2 parents 51b4370 + 2953ae5 commit c05fcc7

File tree

35 files changed

+182
-121
lines changed

35 files changed

+182
-121
lines changed

actionmailbox/test/dummy/config/environments/development.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# In the development environment your application's code is reloaded any time
77
# it changes. This slows down response time but is perfect for development
88
# since you don't have to restart the web server when you make code changes.
9-
config.cache_classes = false
9+
config.enable_reloading = true
1010

1111
# Do not eager load code on boot.
1212
config.eager_load = false

actionmailbox/test/dummy/config/environments/production.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Settings specified here will take precedence over those in config/application.rb.
33

44
# Code is not reloaded between requests.
5-
config.cache_classes = true
5+
config.enable_reloading = false
66

77
# Eager load code on boot. This eager loads most of Rails and
88
# your application in memory, allowing both threaded web servers

actionmailbox/test/dummy/config/environments/test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# test suite. You never need to work with it otherwise. Remember that
66
# your test database is "scratch space" for the test suite and is wiped
77
# and recreated between test runs. Don't rely on the data there!
8-
config.cache_classes = true
8+
config.enable_reloading = false
99

1010
# Do not eager load code on boot. This avoids loading your whole application
1111
# just for the purpose of running a single test. If you are using a tool that
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# frozen_string_literal: true
22

33
module ActionDispatch
4-
# ActionDispatch::Reloader wraps the request with callbacks provided by ActiveSupport::Reloader
5-
# callbacks, intended to assist with code reloading during development.
4+
# ActionDispatch::Reloader wraps the request with callbacks provided by
5+
# ActiveSupport::Reloader, intended to assist with code reloading during
6+
# development.
67
#
7-
# By default, ActionDispatch::Reloader is included in the middleware stack
8-
# only in the development environment; specifically, when +config.cache_classes+
9-
# is false.
8+
# ActionDispatch::Reloader is included in the middleware stack only if
9+
# reloading is enabled, which it is by the default in +development+ mode.
1010
class Reloader < Executor
1111
end
1212
end

actiontext/test/dummy/config/environments/development.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# In the development environment your application's code is reloaded any time
77
# it changes. This slows down response time but is perfect for development
88
# since you don't have to restart the web server when you make code changes.
9-
config.cache_classes = false
9+
config.enable_reloading = true
1010

1111
# Do not eager load code on boot.
1212
config.eager_load = false

actiontext/test/dummy/config/environments/production.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Settings specified here will take precedence over those in config/application.rb.
55

66
# Code is not reloaded between requests.
7-
config.cache_classes = true
7+
config.enable_reloading = false
88

99
# Eager load code on boot. This eager loads most of Rails and
1010
# your application in memory, allowing both threaded web servers

actiontext/test/dummy/config/environments/test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# test suite. You never need to work with it otherwise. Remember that
66
# your test database is "scratch space" for the test suite and is wiped
77
# and recreated between test runs. Don't rely on the data there!
8-
config.cache_classes = true
8+
config.enable_reloading = false
99

1010
# Do not eager load code on boot. This avoids loading your whole application
1111
# just for the purpose of running a single test. If you are using a tool that

actionview/lib/action_view/railtie.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class Railtie < Rails::Engine # :nodoc:
7474
initializer "action_view.caching" do |app|
7575
ActiveSupport.on_load(:action_view) do
7676
if app.config.action_view.cache_template_loading.nil?
77-
ActionView::Resolver.caching = app.config.cache_classes
77+
ActionView::Resolver.caching = !app.config.reloading_enabled?
7878
end
7979
end
8080
end
@@ -91,7 +91,7 @@ class Railtie < Rails::Engine # :nodoc:
9191

9292
config.after_initialize do |app|
9393
enable_caching = if app.config.action_view.cache_template_loading.nil?
94-
app.config.cache_classes
94+
!app.config.reloading_enabled?
9595
else
9696
app.config.action_view.cache_template_loading
9797
end

actionview/test/ujs/server.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Server < Rails::Application
1616
get "/error" => proc { |env| [403, {}, []] }
1717
end
1818

19-
config.cache_classes = false
19+
config.enable_reloading = true
2020
config.eager_load = false
2121
config.secret_key_base = "59d7a4dbd349fa3838d79e330e39690fc22b931e7dc17d9162f03d633d526fbb92dfdb2dc9804c8be3e199631b9c1fbe43fc3e4fc75730b515851849c728d5c7"
2222
config.paths["app/views"].unshift("#{Rails.root}/views")

activerecord/lib/active_record/railtie.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ class Railtie < Rails::Railtie # :nodoc:
389389

390390
initializer "active_record.unregister_current_scopes_on_unload" do |app|
391391
config.after_initialize do
392-
unless app.config.cache_classes
392+
if app.config.reloading_enabled?
393393
Rails.autoloaders.main.on_unload do |_cpath, value, _abspath|
394394
# Conditions are written this way to be robust against custom
395395
# implementations of value#is_a? or value#<.

0 commit comments

Comments
 (0)