Skip to content

Commit 4119e57

Browse files
author
Robert Mosolgo
committed
Merge pull request #526 from molawson/fix-to_prepare-deprecation
Fix Rails 5 .to_prepare deprecation warning
2 parents b305b17 + 541a02a commit 4119e57

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/react/rails/railtie.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,11 @@ class Railtie < ::Rails::Railtie
8585

8686
React::ServerRendering.reset_pool
8787
# Reload renderers in dev when files change
88-
ActionDispatch::Reloader.to_prepare { React::ServerRendering.reset_pool }
88+
if Gem::Version.new(::Rails::VERSION::STRING) >= Gem::Version.new("5.x")
89+
ActiveSupport::Reloader.to_prepare { React::ServerRendering.reset_pool }
90+
else
91+
ActionDispatch::Reloader.to_prepare { React::ServerRendering.reset_pool }
92+
end
8993
end
9094

9195
initializer "react_rails.setup_engine", :group => :all do |app|

0 commit comments

Comments
 (0)