-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Load models from eager_load, not autoload_paths #2771
Conversation
This makes sense to me. I currently have to explicitly exclude classes in lib. Annoying! |
@impurist ActiveRecord |
@mshibuya どう思いますか? |
So eager_load_paths is poorly named |
Agreed, but it would be better to have a spec that will fail without this change. |
If something is in `autoload_paths`, it doesn't mean it can or should *always* be loaded. Rails explicitly makes this distinction with `eager_load`. E.g. if I'm developing a Rails engine, I might want to add `lib` to autoload paths (to ease the development of the engine), but that doesn't mean I want to eagerly load ruby files in `lib/generators/templates`! Resolves railsadminteam#2770
@mshibuya Done |
Nice, can be merged if the rubocop offense is fixed. |
@mshibuya Sorry, didn't notice it. Now fixed! |
Thanks for the fix! |
If something is in
autoload_paths
, it doesn't mean it can or should always be loaded. Rails explicitly makes this distinction witheager_load
.E.g. if I'm developing a Rails engine, I might want to add
lib
to autoload paths (to ease the development of the engine), but that doesn't mean I want to eagerly load ruby files inlib/generators/templates
!Resolves #2770