A plugin inside an engine

In Rails 3, is it possible to have a plugin inside an engine?

Adding the lib dir of the plugin to autoload_paths doesn't seem to work.

I can manage to load it by adding that path to $: and requiring the init.rb file, but I'm not sure that's the correct approach.

Thanks!

Reading through the source in railties/lib/rails/paths.rb, I found this:

module MyEngine   class Engine < Rails::Engine     config.after_initialize do       ::AppName::Application.config.paths.vendor.plugins.push File.expand_path('../../vendor/plugins', __FILE__)     end   end end

Is that correct? If it is, then it begs the question, how do I access the app configuration without directly referencing it's name (::AppName)?

Rails.application, I think

You can access it via `Rails.configuration` :slight_smile:

Or if you want to access via application instance, you can use `Rails.application.config`

Of course, didn't think of that. It appears to work beautifully, so I guess this is the correct approach.

Thanks!

Spoke too soon without testing enough.

It appears the plugin classes are loaded, but the init code is not.

Oh sorry, I saw some similar questions on this list, so I posted here.