Which code calls init.rb in a plugin?

Can anyone point me to the code that calls init.rb in a plugin? install.rb? the code in tasks?

I have installed several plugins but find that they never seem to be initialized. I like poking around in code but can't seem to find the code that actually calls init.rb. Nothing I've found on the web seems to address this.

It occurs to me that there may be an environment variable that needs to be set to bring in plugins. Any thoughts? Information concerning plugins seems very limited. I haven't yet found any information about what is going on in the background to make them work.

Thanks. DocPneumo 9/4

Presuming that you have a copy of Rails in your /vendor....

Each plugin's init.rb file is ultimated invoked by the 'load_plugin' method in vendor/rails/railties/lib/initializer.rb. This is invoked each time your config/environment.rb is read (i.e. each time the server starts).

The code which calls install.rb is in vendor/rails/railties/lib/commands/plugin.rb (see Plugin#run_install_hook), and is only evaluated when you install a plugin via the script/plugin command.

There are no environment variables which influence the loading of plugins - any file called 'init.rb' which is in a subdirectory of /vendor/plugins *should* be evaluated.

Shameless plug: my short cut e-book "Rails Plugins" might be of some assistance - it'll be available in the next week or so, via

- james


That is a great help. I'll be working my way thru initializer.rb tonight! The blurb on your coming book looks good. Will watch for it's release.