On 7/27/07, Rob Morris <[EMAIL PROTECTED]> wrote:
>     How do I figure out, safely and consistently, that a given plugin
> has been installed?  I seem to recall some sort of list being maintained
> by Rails, but couldn't find where I read about it.  Is there such a
> list?  When does it get initialized?

The engines plugin, for Rails 1.2, created an array of all the loaded
plugins, accessible via "Rails.plugins". This is a list of every
plugin that was loaded (and reflects the order they were loaded too).
This list is set up as soon as the engines plugin loads, and is then
built by the Rails::Initializer extensions that the engines plugin
provides.

Rails.plugins is actually a PluginList, which means that you can do

  Rails.plugins.first
  Rails.plugins[0]
  Rails.plugins[:plugin_name]
  Rails.plugins["plugin_name"]

... and they all will return the plugin at the given index, or with
the given name.

> Second question:
>
>     I'm planning on creating the relationships using polymorphic
> associations.  Is there a smarter/better way to do this?  Has anyone
> tried cross-plugin associations?

You should be able to do this, as long as Plugin A doesn't need to
actually load or instantiate any of the models from Plugins B before
Plugin B has loaded. Any kind of inter-plugin-dependency will need
careful management to ensure that code isn't eagerly loaded while the
plugins are loading.

HTH,

James

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

Reply via email to