engines: accessing classes from the hosting-apps lib

I have an engine and can access model-classes of the hosting app without any troubles.

But when I try to access classes that are defined in the lib-directory of the hosting app, they are not found and I get a

uninitialized constant Redmine

where Redmine is a module defined in the lib-directory of the hosting app. The lib-directory has added this dir to the autoload_paths, but the engine does not see them. The documentation (http://api.rubyonrails.org/classes/Rails/Engine.html) here is a litte vague:

The Application class adds a couple more paths to this set. And as in your Application, all folders under app are automatically added to the load path. If you have an app/observers folder for example, it will be added by default.

but the paths defined as autoload_paths are not added by default?!

Is there a way I can get the engine to load the classes in the lib-dir of the hosting app?!

thx for any help,

stefan

ok, got this one:

reason for the trouble was the load-sequence: I tried to include a module from the hosting app inside a class inside my plugin: this fails inside tests, as the plugin-classes are loaded before the rest of the app (or at least, that is my guess): I solved this by including the module only at runtime with a

class MyPluginClass

def initialize

self.class.send :include, ::Redmine::I18n unless self.class.include? ::Redmine::I18n

end

end

This gets rid of the direct include-dependency and postpones the include: When the class is loaded for the first time, the include is added - now all classes, even the ones from lib are available.