Skip to content

Commit 5f5d2d3

Browse files
pixeltrixjosh
authored andcommitted
Move cleanup before prepare_dispatch so that constants are not loaded twice [#1898 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
1 parent 50f51ff commit 5f5d2d3

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

actionpack/lib/action_controller/dispatcher.rb

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,15 @@ def _call(env)
8888
end
8989

9090
def reload_application
91+
# Cleanup the application before processing the current request.
92+
ActiveRecord::Base.reset_subclasses if defined?(ActiveRecord)
93+
ActiveSupport::Dependencies.clear
94+
ActiveRecord::Base.clear_reloadable_connections! if defined?(ActiveRecord)
95+
9196
# Run prepare callbacks before every request in development mode
9297
run_callbacks :prepare_dispatch
9398

9499
Routing::Routes.reload
95-
96-
# Cleanup the application by clearing out loaded classes so they can
97-
# be reloaded on the next request without restarting the server.
98-
ActiveRecord::Base.reset_subclasses if defined?(ActiveRecord)
99-
ActiveSupport::Dependencies.clear
100-
ActiveRecord::Base.clear_reloadable_connections! if defined?(ActiveRecord)
101100
end
102101

103102
def flush_logger

0 commit comments

Comments
 (0)