An HMVC module to specialize controllers and views

Hello all,

At EITA, we use Noosfero social-economic with multiple plugins (think of engines), each one with its models, controllers and views.

These plugins may interact with other, even overwriting the behaviour of another plugin. That is where HMVC enters. The stating point for that in Controller Inheritance. By making one plugin’s controller inherit another plugin’s controller, you mean you want to reuse/overwrite its actions and partials/templates, and replace URLs to use the more specific controller.

It is something like the STI in models.

I have made a simple module,, with which you may call on the controller:

hmvc PluginClass

The PluginClass respond to a controllers method to know which controllers are defined on this hmvc context. Then it create a hash of controllers paths, based on controllers’ classes inheritance. With this, partials/templates will look up on the entire inheritance tree and URLs are replaced to use the most specific controller available on the inheritance tree.

This HMVC model is not a multi-app model with each app sending requests to one another. It is in-app HMVC.

Also, something similar was done to I18n, allowing translations overwrite, depending on context.

I would like to make this a gem (maybe rails-hmvc), so anyone interested in colaborate please contact me.