Want to use a single rails application for multiple sites / domains

I have a client who needs the same custom CMS as for 5 applications. All applications will have a "similar" but excellent appearance, and I really would like one rails application to handle this and just change the layout / views as needed. Is there a gem / plugin or use case for this?

+6
ruby-on-rails dns
source share
4 answers

The Doug proposal will work if the differences between the sites are purely stylish and static - for example, if you basically just β€œskin”. But I will be careful after this approach, if the differences are more active than this. You could very easily get a nightmare for maintenance, while all your business logic is surrounded by case statements and many special codes distributed through your application. And you really would feel pain if you wanted to split sites on different servers or make significant functional changes to some of the sites, but not others.

If you expect any significant differences between sites, you can consider developing them as separate Rails projects with common components. Put the code that they divide into gems or plugins, and reserve separate projects for attributes that they do not share. For a small increase in overhead, you will gain much more flexibility along the way.

+6
source share

You can start with the DHH Account Location plugin as a launch, but change it to use a top-level domain name (TLD) instead of a subdomain. This is a very simple library, but it does its job. Just remember to cover all of your in-app finds with an Account associated with a domain name.

+3
source share

I created something specifically for this purpose several years ago. For a while I did not touch on this, but there is activity on the network on github. Rails Multisite Plugin

0
source share

Paulbonner's answer pretty much reflects what I think myself: if sites diverged over time, that would be a nightmare to support later.

Therefore, I probably create several separate Rails applications, but I would use something like Rails Cells to develop functionality common to all websites. Then I would split all my cells in all applications using svn: externals or the equivalent from Git.

0
source share

All Articles