I organize a multi-tenant application with a single base / code application, using subdomains to detect the tenant, and then run SET SCHEMA on postgres to do funny things.
My problem is that some clients will need different levels of customization for the main code base. Not a ton, but, of course, enough that I did not want to start hacking into the main models and controllers, adding a bunch of if statements.
Overriding views is simple enough with image loading paths ... but my question is: how can I provide a good structure to override or add functionality to the base controllers, models, and helpers to customize things for each tenant as needed? Ideally, this should be fairly seamless and non-invasive for the main code and should provide a decent mechanism for organizing custom code.
I explored several options, including using include / extends (mixins). The problem is that during production methods remain in objects (understandably). I tried using gte mixology to work on this, but it doesnβt fully work as I expected, and its a little more invasive than I would like, I also donβt understand how to associate it with models (in controllers I just tried mixin / unmix through before / after filters.)
If anyone has any ideas on how best to approach / solve this problem, I would really appreciate your feedback. FWIW is Rails3
source
share