Skip to content

Commit 2f88ab3

Browse files
committed
Merge pull request #474 from jeremy/rails5-reloader-forward-compat
Use the Rails 5 reloader API if available
2 parents f90890b + 4568cbe commit 2f88ab3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/spring/application.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,13 @@ def serve(client)
149149
setup command
150150

151151
if Rails.application.reloaders.any?(&:updated?)
152-
ActionDispatch::Reloader.cleanup!
153-
ActionDispatch::Reloader.prepare!
152+
# Rails 5.1 forward-compat. AD::R is deprecated to AS::R in Rails 5.
153+
if defined? ActiveSupport::Reloader
154+
Rails.application.reloader.reload!
155+
else
156+
ActionDispatch::Reloader.cleanup!
157+
ActionDispatch::Reloader.prepare!
158+
end
154159
end
155160

156161
pid = fork {

0 commit comments

Comments
 (0)