Rails 默认组件都是 Railtie

Action Mailer

初始化:

logger

set_configs

compile_config_methods

show_previews

Abstract Controller

引入 Route 相关的 helper(这里只是调用,定义在 RouteSet 里)。

routes.rb 里定义的每一个路由规则都会有对应的 x_url 和 x_path 等 helper 方法可用,这里 include 了这些 helper.

然后,Action Controller 和 Action Mailer 的 Railtie 又 extend Routes Helpers,所以可用。

Note: 可以通过 include Rails.application.routes.url_helpers 然后调用和 Routing 相关的 helper 方法。

Action Controller

initializer

配置可通过以下方式查看:

默认配置项:

Action Dispatch

初始化 configure 及其它。

Action View

Active Model

加载 Action Model 相关 I18n

Active Record

获取 database.yml 的配置信息:

... ...

Active Job

另,配置默认 queue_adapter 由默认的 :inline 改为了 :async

Active Support

I18n

after_initialize 和 before_eager_load 都执行 initialize_i18n

最后更新于

这有帮助吗?