Skip to content

Commit ce3d79e

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 83109a5 commit ce3d79e

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
@@ -40,7 +40,7 @@ class Railtie < Rails::Railtie
4040

4141
config.after_initialize do |app|
4242
FactoryBot.find_definitions
43-
Reloader.new(app).run
43+
Reloader.new(app).run if !app.config.cache_classes && app.config.reload_classes_only_on_change
4444
app.config.factory_bot.validator.run
4545
end
4646

0 commit comments

Comments
 (0)