Skip to content

Commit 0b8dfae

Browse files
committed
Uses subclasses instead of descendants to support Rails < 7.1
We do override `subclasses` in railties to remove the abstract railties[1], so in versions of rails that `descendants` is implemented in terms of `subclasses` we get the same behavior, but in earlier versions of rails `descendants` includes abstract railties which we don't want. Fixes #737. [1]: https://github.com/rails/rails/blob/b164bb832e8e11e7fb10f3c47d93ba29a98f2a94/railties/lib/rails/railtie.rb#L147-L149
1 parent a438d54 commit 0b8dfae

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/spring/application.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,9 @@ def preload
129129

130130
if defined?(Rails) && Rails.application
131131
watcher.add Rails.application.paths["config/initializers"]
132-
Rails::Engine.descendants.each do |engine|
133-
if engine.root.to_s.start_with?(Rails.root.to_s)
132+
rails_root = Rails.root.to_s
133+
Rails::Engine.subclasses.each do |engine|
134+
if engine.root.to_s.start_with?(rails_root)
134135
watcher.add engine.paths["config/initializers"].expanded
135136
end
136137
end

0 commit comments

Comments
 (0)