On 8/29/07, Tekin Suleyman <[EMAIL PROTECTED]> wrote:
> I then tried it without specifying the plugin load order (config.plugins
> = ['engines', '*']) and there is no error, despite the plugins loading
> in the same order. If I explicitly specify the plugin (config.plugins =
> ['engines', 'testplugin']), it also works.
>
> Is this expected behaviour?

Aaaaah. OK. Here's what's happening.

To support the

  config.plugins = %w(engines *)

behaviour, the engines plugin actually defers loading of any plugins
that weren't specified manually by using the after_initialize
mechanism. You're seeing a problem because, when using that
star-syntax, at the point where Rails is trying to instantiate your
observer your testplugin hasn't been loaded yet.

The solution, for the moment, is to just add your observer-containing
plugins explicitly to config.plugins - that way they will definitely
be available before Rails starts dealing with observers. Another
solution would be to call YourObserverClass.instance at the bottom of
environment.rb, rather than using config.observers - either will work
fine.

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

Reply via email to