Am 25.01.2008 um 12:26 schrieb James Adam:

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

Absolutely. I'm pretty sure this is the reason for this kind of  
behaviour.

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

IMO there's no sane reason as to why plugins and libs should behave  
differently from any app model class *by default*. It's not only  
counterintuitive but leads to major issues when one tries to work  
around it.

I've talked to Rick Olson briefly about this issue on IRC and he  
agreed that this behaviour not only sucks but also might be something  
that should be changed in some future major Rails release (like Rails  
3.0).

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

Me too.

Reportedly there are quite some plugins that rely on the behaviour of  
plugins not being reloaded. Thus it would be kind of an "political"  
issue to change this and break "lots of plugins".

Maybe you're somebody who could raise this question on Rails core?


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

--
sven fuchs                      [EMAIL PROTECTED]
artweb design           http://www.artweb-design.de
grünberger 65           + 49 (0) 30 - 47 98 69 96 (phone)
d-10245 berlin          + 49 (0) 171 - 35 20 38 4 (mobile)



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

Reply via email to