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