I use the gem of an apartment , which is good for managing multi-tenant environments. The apartment helps you manage schematic databases and helps you with migration.
The application uses the correct scheme depending on the subdomain. For example, in the case of superclient.mysuperapp.com, the rails will use the superclass database schema and will only work on this schema until the request completes.
For multitenant views , in my case, I use before_action in ApplicationController.rb to prepend my custom view path:
def prepend_view_paths subdomain = request.subdomain prepend_view_path "app/views/multitenancy/
Where the subdomain in this case is a superclient.
The logic is this: first, the rails will look for an idea along this path: "app / views / multitenancy / # {subdomain}". And if he does not find anything, he continues to find representation in other ways in the list.
Hope my answer helps you.
source share