title: Rails - Multi tenant application with customization framework
body: <p>I am organizing a multi tenant application with a single code base/application using subdomains to detect the tenant, then runs a SET SCHEMA on postgres to do the fun stuff.</p>
  
  <p>My issue is that certain clients will require various levels of customization to the main codebase. Not a ton, but certainly enough to the point that I wouldn't want to start hacking the main models and controllers by adding a bunch of if statements.</p>
  
  <p>Overriding views is easy enough with views load paths...  but my question is: How can I provide a good framework for overriding or adding functionality to the base controllers, models and helpers to tweak things for each tenant as needed? Ideally it should be pretty seamless and not invasive to the main code, and should provide a decent mechanism for organizing the customized code.</p>
  
  <p>I've investigated a few options, including using includes/extends (mixins). The issue is that in production, methods stay in the objects (understandable). I've tried hte mixology gem to work around this, but it doesn't totally work as I had intended and its a bit more invasive than I'd like it to be, I'm also unclear how to relate it to models (in the controllers I just tried mixin/unmix via before/after filters).</p>
  
  <p>If anybody has any ideas on how to best approach/solve this issue, I would greatly appreciate your feedback. FWIW this is Rails3</p>