如何获取Rails 3应用程序中所有引擎的列表 [英] How to get the list of all engines in Rails 3 app
本文介绍了如何获取Rails 3应用程序中所有引擎的列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Rails :: Initializer.new(Rails.configuration).plugin_loader.engines
$ b $ p 这段代码在Rails 3中不起作用
ActionController :: RoutingError(Rails :: Initializer:Module的未定义方法`new'):
config / application.rb:12:'require_or_load'
在Rails 3中需要做什么来获取这样的引擎列表?
解决方案
截至2011年5月10日和Rails 3.1测试版,现在是
Rails :: Application :: Railties.engines
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
解决方案
As of 5/10/2011 and Rails 3.1 beta, it's now
Rails::Application::Railties.engines
这篇关于如何获取Rails 3应用程序中所有引擎的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文