Refactoring Files into Subfolders without Updating Namespacing - Is it Possible?

This message was imported from the Ruby/Rails Modularity Slack server. Find more info in the import thread.

Message originally sent by slack user U727X2O54PN

Is it possible to refactor files into subfolders without updating the namespacing? Or is there a way I can get an editor like rubymine to update my namespacing for me in a reliable way? Forgive the possibly n00b ruby/rails question here (it’s been a few years since I’ve done this professionally). :thread:

Message originally sent by slack user U727X2O54PN

Right now my app is the typical rails folder structure
app
-> controllers
-> models
....

Instead I want
app
-> domain1
--> controllers
--> models
--> ...
-> domain2
--> controllers
--> models
--> ...

Right now doing that move is a PITA since I have to update the namespacing on every file. E.g. if I have app/services/foo.rb and want to move it to app/domain1/services/foo.rb, I have to re-name Foo everywhere as Services::Foo.

Message originally sent by slack user U727X2O54PN

FWIW, I don’t care about app nor the controller, model structure. I just care about organizing files into domains

Message originally sent by slack user U70I61FD0VD

Take a look at packs-rails, it lets you achieve a similar result, but instead of doing app/domain1 and app/domain2, you would do packs/domain1/app and packs/domain2/app