Skip to content

Only reload if cache_classes is disabled and reload_classes_only_on_change #533

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

stanhu
Copy link

@stanhu stanhu commented May 13, 2025

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.

…hange 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.
@stanhu stanhu force-pushed the sh-stop-reloading-classes branch from 5d2fc14 to ce3d79e Compare May 13, 2025 01:05
@stanhu stanhu changed the title Only reload if cache_classes is disabled and reload_classes_only_on_c… Only reload if cache_classes is disabled and reload_classes_only_on_change May 13, 2025
@stanhu
Copy link
Author

stanhu commented May 13, 2025

Hmm, this is not so easy to test directly because require 'fake_app' in spec_helper.rb always calls after_initialize, and that is only run once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant