Rails: Multiple Sites (Multisites) in one Web Application

0
123

Did you know it is possible to host multiple sites in one web application? It’s actually quite easy! The one issue you will run into is with scaling it. This method is pretty simple, but it does not scale well. With some tweaks, you could overcome that, though. Here’s how you do it:

First, you will want to setup a basic route and a controller.

https://gist.github.com/thehashrocket/e13cd351ff67339c203c26a7e1c86417.js

Finally, you will want to setup a different default layout for each of your sites.

https://gist.github.com/thehashrocket/2e4b248de5599725179d32a3c503dc98.js