On Fri, Jan 25, 2008 at 11:26:15AM +0000, James Adam wrote:
> Hmmm. Something's occurred to me.
> 
> With the implementation of engines 1.1.x, the app/models directory
> wasn't involved dur the plugin loading process, which meant that it
> wouldn't be added to load_once_paths.
> 
> However, with 2.x, we're now hooking into a plugin-generic load_paths
> mechanism, which means that paths we add to the $LOAD_PATH via this
> are candidates for inclusion in load_once_paths.
> 
> This could explain why reloading classes from plugins (well, from
> app/models) used to be easier, but now requires some extra steps.
> 
> Does this make sense?

Sounds logical.

> I'm not sure that there's an ideal solution,
> unfortunately - Rails probably wants to keep the notion of
> "load_once_paths", and reverting the behaviour of the engines plugin
> makes it significantly more complicated.

Maybe we can somehow hack Rails::Plugin::Loader#add_plugin_load_paths
to exclude any paths added by engines, then we're good.  I don't know
if Engines can currently distinguish between an Engine and a regular
plugin, though.

> I'm curious about which plugins might break without load_once_paths...

I think a lot will fail.  Simply commenting out the line in the above
mentioned module gave me a stack overflow somewhere in pluginify_sources.
However, after retrying another time I didn't get this error.
Maybe the plugin_load_once_paths is an attempt to cover up some bug
in Rails' autoloading system?

Cheers,
Peter Bex
Solide ICT - http://www.solide-ict.nl
_______________________________________________
Engine-Developers mailing list
[email protected]
http://lists.rails-engines.org/listinfo.cgi/engine-developers-rails-engines.org

Reply via email to