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? 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.

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

On 25/01/2008, Peter Bex <[EMAIL PROTECTED]> wrote:
> On Wed, Dec 12, 2007 at 05:51:48PM +0000, James Adam wrote:
> > I'm not sure that Rails has ever allowed automatic reloading of code
> > from plugins in development - can anyone confirm this?
>
> No idea about Rails, but with Engines in 1.x it used to Just Work.
>
> What's even worse is that if you include engines and load a model from
> an engine in your app's model, it gets marked unreloadable, too!
> So if you have
>
> app/models/user.rb
>
> require_dependency(File.join(RAILS_ROOT, 
> "vendor/plugins/accounts/app/models/user.rb"))
>
> class User < ActiveRecord::Base
> ...
> end
>
> and you change something in there, you will need to restart your server, too!
> This really makes it unusable, IMHO.
>
> Right now I'm just hacking around it by putting
> Dependencies.load_once_paths = []
> in my environment.rb.  It's a hack, but without it really really sucks.
>
> 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
>


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

Reply via email to