This is what I'm trying to achieve. I want to build an application with an admin and client portal. So I want to build a single RoR application for both these portals and I would like to keep the code of each portal separated at the root level. So basically following is the folder structure I want to have in my project.
/admin
/client
/modals
/config
/db
... ...
So I want to keep controllers, views, and other stuff relevant to each project in each folder separately.
So I want to move the modal folder to the root level as well. I read about the namespaces in RoR, but as I understand I'm unable to do it with namespaces alone. I guess I need to do some configuration level changers, don't I?
Please let me know if there is a way to do this.
Thank You.
What you're suggesting sounds like 5 Rails apps running independently. Does each one of those directories have its own Gemfile
, database?
It would be possible to do what you want, but it will almost certainly be more trouble than it's worth. You'll have to override some path configurations, make adjustments to connect the models/views/controllers
directories for each entity (https://guides.rubyonrails.org/action_view_overview.html#view-paths), and probably much more. Rails is an opinionated framework and it doesn't do things like this gracefully.
The 'Rails' way to do it would be to:
app/models/admin app/views/admin app/controllers/admin etc.
directoriesclass Admin::SomeController < ApplicationController
If each of those is really its own app, then you would probably want to create a repository for each of them so that they're in version control separately.