Reputation: 3742
I want to create one site with multiple subdomains each of which provide different functionality.
All that they have in common are:
So, what is the best way to design the architecture (on RoR3):
Upvotes: 1
Views: 373
Reputation: 9623
If you keep all the websites in the same app, you should be sure that the problem domains are all similar, and functions are going to be similar, and only content is different (e.g. all variants on Q&A sites, but with different content/domains covered). If that's the case it might be worth keeping them in the same site as it would let you trivially share login info and other stuff like templates/code.
Otherwise IMHO you'd be better splitting them into separate apps which share code and a users database, but are otherwise distinct, and can diverge as they grow while sharing where it makes sense.
If you separate the apps, you could put shared code/templates into a gem or library (which is how rails started after all), which you then share between all of them, and/or put any common services into another backend web app which serves them all but is never seen by users.
Logins won't persist across domains, so you'll only be able to share username/pass, not keep them persistently logged in, unless you get into creating a service to do so which talks to all the apps. See this answer for more details.
How to create a Shared Login Service across Multiple Domains?
Upvotes: 1