Forum: Ruby on Rails How to Affect Plugin Load Order

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Steve R. (Guest)
on 2006-01-31 03:36
I'm using bundled_resource, login_engine, and a few other plugins. It
appears Rails considers plugins in alphabetic order. Turns out that
there is a particular order that will work and alphabetic ain't it.

The login engine must be loaded first. Bundled resource then includes
'application_helper' and the application helper includes LoginEngine. If
bundled_resource is allowed to load first, when it includes
'application_helper' the include LoginEngine fails with an undefined

Is there a way to change plugin load order?

Rick O. (Guest)
on 2006-01-31 05:17
(Received via mailing list)
On 1/30/06, Steve R. <removed_email_address@domain.invalid> wrote:
> Is there a way to change plugin load order?
> Thanks

Why not just fudge the names a bit?  a_login_engine will cause it to
load first :)

Rick O.
Steve R. (Guest)
on 2006-01-31 06:35
I actually did it the other way around: zbundled_resource.

But seriously, we deal with dependencies all over the development
process. Ruby Gems are good with dependencies, and other parts of Rails
are. Isn't there a cleaner way to deal with this?

Steve R.

Rick O. wrote:
> On 1/30/06, Steve R. <removed_email_address@domain.invalid> wrote:
>> Is there a way to change plugin load order?
>> Thanks
> Why not just fudge the names a bit?  a_login_engine will cause it to
> load first :)
> --
> Rick O.
Gerret A. (Guest)
on 2006-01-31 09:08
(Received via mailing list)

the engines plugin requires you to call "start_engine" for just this
reason -- if your engine depends on another plugin, there's no way to
guarantee that the dependency will be loaded before the engines

IIRC, the idea is for "start_engine" to disappear as soon as rails
supports user-defined plugin load order. So long story short, I don't
believe there's a way to determine that load order atm, other than by
patching the rails source.

James A. (Guest)
on 2006-01-31 19:07
(Received via mailing list)
This issue isn't really related to the fact that engines need to be
'started', as the problem would occur with if the file being require'd
at the top of application_helper.rb was a part of any plugin that
hadn't been processed yet.

The next release of Rails should make things *slightly* better,
because as I recall I had a patch accepted which added all the plugin
'lib' directories before performing any of the init.rb code. However
I'm not sure if that code remains intact.

The 'best' way that I can think of to avoid this issue at the moment
would be for plugins not to load files like application_helper.
However, I can perfectly understand why Duane has done this...

- james

On 1/31/06, Gerret A. <removed_email_address@domain.invalid> wrote:
> patching the rails source.
> >
> > >
> > removed_email_address@domain.invalid
> >
> >
> _______________________________________________
> Rails mailing list
> removed_email_address@domain.invalid

* J *
Duane J. (Guest)
on 2006-02-02 16:27
(Received via mailing list)
While the plugin load order hasn't necessarily been fixed, I just
want to mention that bundled_resource no longer loads
application_helper, and therefore has no conflict with the engines

It turns out the fix was simple: include bundle helper modules in the
ActionView::Base class instead of the ApplicationHelper class.  Works
like a charm :)

I wonder if engines could use this technique also?  It might be nice
for some functionality to be automagic so that no modification to
ApplicationHelper is necessary.

James A. (Guest)
on 2006-02-02 16:42
(Received via mailing list)
It's something I've thought about, and engine developers are of course
free to do (since engines are still just plugins). At the same time,
though, I can't help but feel it's a bit wrong to slip so deep into
the class heirarchy, though I'm not sure why.

Can someone please convince me that it's a kosher thing to do? In all
truth I would *love* to remove the need to add includes to

* J *
This topic is locked and can not be replied to.