On 2/19/06, Manuel Holtgrewe <[EMAIL PROTECTED]> wrote:
> > Actually, it would be enough if I could write this in my active_rbac
> > engine:
> >
> >    class ActiveRbac::UserController
> >      # ...
> >    end
> >
> > This means that the load-routing would have to be changed...

At the moment, writing this code means that you would get the URL
'/active_rbac/user' - this is 'standard' for all controllers in
modules, but the controller MUST exist in a subddirectory. From what I
can gather, it sounds like you're looking to avoid the requirement
that such a controller is in an 'active_rbac' subdirectory.

I suspect that doing this would require the engines plugin to provide
a fairly complete alternative routing system, and
auto-dependency-loading mechanism too, since this type of behaviour
isn't supported by what Rails provides *at all*. For me, the price of
having to create a few subfolders is by far outweighed by the hassle
of having to develop and then support a whole new dependency layer.

> > Do you by chance know where to look for that magic in Rails? I want
> > to have a look and could drop half an our searching if you know it
> > off your head.

To understand what Rails is doing when it loads controllers, you need
to start by looking at the following files:

  activesupport/lib/active_support/dependencies.rb
  actionpack/lib/action_controller/routing.rb (at the auto-generated
recognize! method)

Personally, I'd like to see the amount of magic that the engines
plugin has to perform actually reduce, rather than increase, since it
makes it much more likely that we can reuse core behaviour. It also
means that developers aren't surprised by the behaviour they see, and
can use their experience with 'normal' rails applications to greatest
effect when developing engines. Principle of Least Surprise,
basically.

Aesthetically, i completely sympathise with what you're suggesting,
and if the Rails dependency loading system could support something
like that easily then it wouldn't be an issue at all... but at the
moment, there doesn't seem to be a simple way of doing this.

--
* J *
  ~
_______________________________________________
engine-developers mailing list
[email protected]
http://lists.rails-engines.org/listinfo.cgi/engine-developers-rails-engines.org

Reply via email to