Skip to content

Commit 5d2fc14

Browse files
committed
Only reload if cache_classes is disabled and reload_classes_only_on_change disabled
https://guides.rubyonrails.org/configuring.html#config-reload-classes-only-on-change states: >>> 3.2.30 config.reload_classes_only_on_change Enables or disables reloading of classes only when tracked files change. By default tracks everything on autoload paths and is set to true. If config.cache_classes is true, this option is ignored. >>> It was surprising to us that even though `cache_classes` were set to true that factory_bot_rails still instantiated file watchers.
1 parent a0adccc commit 5d2fc14

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/factory_bot_rails/railtie.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Railtie < Rails::Railtie
2020

2121
config.after_initialize do |app|
2222
FactoryBot.find_definitions
23-
Reloader.new(app).run
23+
Reloader.new(app).run if !app.config.cache_classes && app.config.reload_classes_only_on_change
2424
end
2525

2626
private

0 commit comments

Comments
 (0)