Search code examples
ruby-on-railsruby-on-rails-3rubygemsruby-on-rails-pluginsrails-engines

How to get the list of all engines in Rails 3 app


According to Rails engines extending functionality in Rails 2.x one could do

Rails::Initializer.new(Rails.configuration).plugin_loader.engines

This code is not working in Rails 3

ActionController::RoutingError (undefined method `new' for Rails::Initializer:Module):
  config/application.rb:12:in `require_or_load'

What do I need to do in Rails 3 to get such list of engines?

This is needed for Extending controllers of a Rails 3 Engine in the main app


Solution

  • As of 5/10/2011 and Rails 3.1 beta, it's now

    Rails::Application::Railties.engines