3
基本上我想加载此:是否可以避免使用Rails 3加载action_controller?
require "active_record/railtie"
require "active_resource/railtie"
require "action_mailer/railtie"
,并不会加载action_controller
因为在这个特定情况下,我都用不到它。在the code in Rails' master
看,我可以看到:
# For now, action_controller must always be present with
# rails, so let's make sure that it gets required before
# here. This is needed for correctly setting up the middleware.
# In the future, this might become an optional require.
require "action_controller/railtie"
...所以我想知道:是否有可能加载Rails的只有active_record
,active_resource
和action_mailer
,还是我总是要加载action_controller
?
为什么在这种情况下你需要使用导轨?只需在自己的脚本中包含ActiveRecord,ActiveResource和ActionMailer gems? – cpjolicoeur 2012-03-27 14:11:58
出于好奇,你为什么要放弃ActionController?是否有一些更深层次的优化(例如尽可能最小的内存占用)或其他类似的东西? – jefflunt 2012-03-27 14:14:45
@cpjolicoeur:我试过了,最后有一个模拟导轨的〜100行文件。 – marcgg 2012-03-27 14:21:52