3 ms·
What’s the difference between lib and app/lib if they both autoload or both don’t? Or is the solution to just put everything in a folder that always get autolo
by nico 4y ago
What’s the difference between lib and app/lib if they both autoload or both don’t?
Or is the solution to just put everything in a folder that always get autoloaded?
Wouldn’t that be the same as autoloading lib?
- wkdneidbwf 4y agoif they both did or didn’t autoload there would be no practical difference. but by default every dir under `app/` autoloads, and `lib/` does not. so using app/lib is really just a reasonable solution for not breaking the existing defaults and conventions.
- jrochkind1 4y agoThe issue OP has run into, if I understand it, is that there are some things that can't autoload and work properly, and when you configure lib/ with a non-default configuration to autoload, there's no place for these things, as lib/ is ordinarily just about the only place in a Rails app that is on the load path but doesn't autoload. No idea what about HN algorithm made this wind up on the front page! It's not an especially interesting post, I agree. Perhaps just a testament to the in fact continued interest in Rails?