File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 6
6
* Avoid ` warning: already initialized constant APP_PATH ` when running
7
7
rails commands that do not use spring (e.g. ` bin/rails server ` would
8
8
emit this when you ^C to exit)
9
+ * Fix ` reload! ` in rails console
9
10
10
11
## 1.1.1
11
12
Original file line number Diff line number Diff line change @@ -91,7 +91,9 @@ def preload
91
91
92
92
require Spring . application_root_path . join ( "config" , "environment" )
93
93
94
+ @original_cache_classes = Rails . application . config . cache_classes
94
95
Rails . application . config . cache_classes = false
96
+
95
97
disconnect_database
96
98
97
99
@preloaded = :success
@@ -161,9 +163,13 @@ def serve(client)
161
163
# Load in the current env vars, except those which *were* changed when spring started
162
164
env . each { |k , v | ENV [ k ] ||= v }
163
165
164
- # requiring is faster, and we don't need constant reloading in this process
165
- ActiveSupport ::Dependencies . mechanism = :require
166
- Rails . application . config . cache_classes = true
166
+ # requiring is faster, so if config.cache_classes was true in
167
+ # the environment's config file, then we can respect that from
168
+ # here on as we no longer need constant reloading.
169
+ if @original_cache_classes
170
+ ActiveSupport ::Dependencies . mechanism = :require
171
+ Rails . application . config . cache_classes = true
172
+ end
167
173
168
174
connect_database
169
175
srand
You can’t perform that action at this time.
0 commit comments