Do you think this may be related to the recent changes to the way
dependencies are reloaded? 

http://weblog.rubyonrails.org/2006/8/11/reloading-revamped/

Also, I came across:

Dependencies.log_activity = true

In my case, I am directly accessing, and modifying another plugin's
model in an init.rb. 

>From a quick scan of the dependency log, it looks like my model is
getting reloaded during each request, which is happening after
initialisation and thus overriding anything in the init.rb

It looks like engines reloads all plugins after initialisation to add
the engines enhancements, which would explain why modifications are
picked up for the first request, as it happens after the app has been
loaded.

I guess the neat fix would be to get engines to reload after each
request and not just in after_initialize()



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Jeroen van Doorn
Sent: 27 February 2007 14:59
To: Discussion of the use of existing Engines
Subject: Re: [Engine-users] lib folders and application controllers


We have a workarround, but we think it's quite dirty!

you could just add an empty model file to your apps model dir and just 
require the original model.
In a test engine we don't have an init.rb and the relations work 
properly over there.

Keep you posted.

Jeroen


Tekin Suleyman schreef:
> I have a similar problem with certain calls in my init.rb only being 
> picked up on the first request..
>
> It appears to me like init.rb is only getting run once during 
> start-up. This would explain why the mixins disappear after the first 
> request - when the entire environment gets reloaded, anything that was

> added in init.rb will not get added the second time!
>
> Having said that, other plugins are still being loaded and mixed in 
> correctly on subsequent requests... I have a feeling it's to do with 
> the way engines enhanced plugins are loaded but I'm not entirely sure 
> how..
>
> Tekin
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Jeroen van Doorn
> Sent: 27 February 2007 14:01
> To: Discussion of the use of existing Engines
> Subject: Re: [Engine-users] lib folders and application controllers
>
>
> We're experiencing some problems which look like the earlier mentioned

> ones.
>
> Somehow the relations within our models are gone after one request. 
> This
>
> isn't the case when we are in production mode, so it has something to 
> do
>
> with loading.
> In the init.rb we are extending the ActionController::Base by using
> "ActionController::Base.class_eval do"
>
> if we use send on calls to ActiveRecord like permission.send(:find,
> :all) it only works on the first call. As soon as we reload the page,
it
>
> breaks. Again in production mode it just works.
>
> We will be wading through the rails core and post back if we find
> something.
> Help is greatly appreciated.
>
> Kind regards,
> Jeroen van Doorn _______________________________________________
> engine-users mailing list [email protected]
>
http://lists.rails-engines.org/listinfo.cgi/engine-users-rails-engines.o
> rg
>
> _______________________________________________
> engine-users mailing list [email protected]
>
http://lists.rails-engines.org/listinfo.cgi/engine-users-rails-engines.o
rg
>
>
>
>   

_______________________________________________
engine-users mailing list
[email protected]
http://lists.rails-engines.org/listinfo.cgi/engine-users-rails-engines.o
rg

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

Reply via email to