Reputation: 1262
I'm trying to build a rails solution which will have more that one area for example i have an area for managers another for users and other for admin. Because each of the area has a number of controllers i don't think is a good idea to have all the controllers in one place because there will be a lot of controllers and it will be harder to mange the code also i want to be able to use some parts of the application like an api. Here is what i have in mind for how the solution should be structured:
/
product_library
users_library
managers
app
config
public
....
users
app
config
public
....
admin
app
config
public
....
shared
app
config
public
....
How can i setup a rails solution to which can allow me to instantiate classes from product_library and user_library and will allow me to use some of the functionality or views from the shared (project or library) ? If my idea of structuring the solution is bad please let me know , i'm open to suggestion on a better structure. Keep in mind that i need separate parts for product library and user library so it can be used in other projects. Also any documentation on how big rails projects are structured is welcomed.
Upvotes: 0
Views: 166
Reputation: 3743
You want to do it within Rails normal structure but with subfolders under each of the MVC components.
app
controllers
managers
users
admin
shared
models
"By default Rails doesn't expect folders in here but it can be done...see below"
views
managers
users
admin
shared
See this answer if you want to separate your models.
Upvotes: 2
Reputation: 743
Your best bet might be to have separate applications. Each would point to the same database. You could put your product_library and users_library stuff in a gem to be loaded by each app. Or just get ghetto with it and put that library stuff in a directory that's symlinked into each app.
Upvotes: 3