engems icon indicating copy to clipboard operation
engems copied to clipboard

engine module / namespace and zeitwerk

Open gap777 opened this issue 3 years ago • 1 comments

@palkan Did your team figure out a way to keep the engine namespaced and NOT have to repeat the engine name as a subdirectory everywhere:

  • engines/subsystem1/app/controllers/subsystem1/application_controller.rb
  • engines/subsystem1/app/controllers/subsystem1/foos_controller.rb
  • engines/subsystem1/app/models/subsystem1/foo.rb
  • engines/subsystem1/app/api/subsystem1/foo_service.rb

gap777 avatar Aug 23 '22 14:08 gap777

Short answer — no. But I understand your pain 🙂

I think, to accomplish this with Zeitwerk, we need to:

  • Disable the existing autoloading configuration for engines
  • Create a custom loader.

palkan avatar Aug 23 '22 20:08 palkan