如果我跑
rails new _4.1.0.beta1_ rails4.1app --skip-test-unit
我在config / application.rb
中找到了这段代码# Pick the frameworks you want:
require "active_model/railtie"
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
require "sprockets/railtie"
# require "rails/test_unit/railtie"
如果创建一个Rails 4.0 app:
rails new _4.0.2_ rails4.0app --skip-test-unit
我在config / application.rb
中得到了这个# Pick the frameworks you want:
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "sprockets/railtie"
# require "rails/test_unit/railtie"
dont rails 4.0.2包括active_model和action_view?我认为这与Action Pack的引入有关,但是我真的很烦我不知道为什么文件不同。
答案 0 :(得分:1)
我所做的只是在rails repo中打开该文件的模板。这是一个link。您可以阅读历史记录,或者只是克隆回购并使用gitk
工具来加快速度。这是我发现的:
Rails 4.0的模板:
<% if include_all_railties? -%>
require 'rails/all'
<% else -%>
# Pick the frameworks you want:
<%= comment_if :skip_active_record %>require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
<%= comment_if :skip_sprockets %>require "sprockets/railtie"
<%= comment_if :skip_test_unit %>require "rails/test_unit/railtie"
<% end -%>
Rails模板当前的Rails主机:
<% if include_all_railties? -%>
require 'rails/all'
<% else -%>
# Pick the frameworks you want:
require "active_model/railtie"
<%= comment_if :skip_active_record %>require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
<%= comment_if :skip_action_view %>require "action_view/railtie"
<%= comment_if :skip_sprockets %>require "sprockets/railtie"
<%= comment_if :skip_test_unit %>require "rails/test_unit/railtie"
<% end -%>
这里没有太大区别。我相信它必须对Rails本身内部的依赖结构做一些事情。例如,现在ActionController没有将ActionView声明为它的必需部分,因此它应该单独加载。