I use the apartment gem which is nice for managing multi tenant environments. Apartment helps you managing schema-based database and helps you with the migration stuff.
The app uses the right schema depending on the subdomain. For example, in the case of superclient.mysuperapp.com, rails will use the superclient database schema and will work only on this schema until the request finishes.
For multitenant views, in my case I use a before_action in ApplicationController.rb to prepend my custom view path:
def prepend_view_paths
subdomain = request.subdomain
prepend_view_path "app/views/multitenancy/#{subdomain}"
end
Where subdomain in this case is superclient.
The logic is this: first, rails will look for a view in this path: "app/views/multitenancy/#{subdomain}". And if it doesn't find anything, it continues to find the view in the other paths on the list.
I hope my response will help you.
views/tenant1/static/about_us.haml
,views/tenant2/static/about_us.haml
. – Oleaster