Overriding code from one engine with another (extending an e

Suppose I want to make an engine that builds on another
engine. Extending engine code is pretty trivial in the application -
but what about in another engine?

The specific case I’m looking at here is addition some additional
authorization framework to the active_rbac engine. I’ve done this in
an application already, but I’d like to package those changes up in
something that can be more easily distributed to other applications
that may want to use it with active_rbac.

Can this be done? Am I asking for trouble?


- Adam

** Expert Technical Project and Business Management
**** System Performance Analysis and Architecture
****** [ http://www.adamfields.com ]

[ Adam Fields (weblog) - - entertaining hundreds of millions of eyeball atoms every day ] … Blog
[ Adam Fields Resume ]… Experience
[ Adam Fields | Flickr ] … Photos
[ http://www.aquicki.com/wiki ]…Wiki

This can be done, although I’m not sure I’d endorse the approach
(despite the fact that it’s how the user_engine layers on top of the
login_engine at the moment, this may not be the case forever). The key
is the order in which you start the engines, i.e.

Engines.start :login, :user

puts the user_engine code in higher priority than the login engine’s
code. It’s pretty simple.

However - doing this can be pretty complex, and used for anything
other than your own internal projects, could prove to be more
complicated to support than you might want to handle. In particular,
since you’re layering over a plugin from a third party, underlying
changes can easily break your wrapper engine.

It might be worthwhile seeing if you can incorporate your changes into
the official active_rbac codebase instead.

James