zeitwerk

Rails 6+, zeitwerk autoloader and namedspaced constants

久未见 提交于 2020-06-16 03:44:26
问题 The Rails 6+ default autoloader is zeitwerk, which seems like a great improvement over previous approaches. However, zeitwork follows the convention for Rails projects that anything in app/* is autoloaded and doesn't need to be namespaced. This works great for app/models/user.rb because you don't have to use Models::User but can just reference User . However, I added my own app/services directory and I namespace my service objects as Services::Users::Create , which would map to app/services