diff --git a/bridgetown-core/lib/bridgetown-core/utils/loaders_manager.rb b/bridgetown-core/lib/bridgetown-core/utils/loaders_manager.rb index f20bc3671..161feb4e1 100644 --- a/bridgetown-core/lib/bridgetown-core/utils/loaders_manager.rb +++ b/bridgetown-core/lib/bridgetown-core/utils/loaders_manager.rb @@ -39,9 +39,11 @@ def clear_descendants_for_reload(_cpath, value, _abspath) end # TODO: this could probably be refactored to work like the above - ActiveSupport::DescendantsTracker.class_variable_get( - :@@direct_descendants - )[value.superclass]&.reject! { _1 == value } + if ActiveSupport::DescendantsTracker.class_variables.include?(:@@direct_descendants) + ActiveSupport::DescendantsTracker.class_variable_get( + :@@direct_descendants + )[value.superclass]&.reject! { _1 == value } + end end def setup_loaders(autoload_paths = []) # rubocop:todo Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity