ruby Linux Controller::API与Linux Controller::Base

ykejflvf  于 2023-10-17  发布在  Ruby
关注(0)|答案(1)|浏览(116)

我想知道API中限制的所有功能,如果我们使用Base代替API,速度会有任何差异。
我搜索了很多地方,以找到这两个模块之间的区别,所有我能够知道它的API是轻量级版本的基地。

zsohkypk

zsohkypk1#

了解两者之间差异的最佳来源当然是它们在源代码中包含的模块列表。
哪个ActionController::Base包含这些模块(注解已删除并按顺序排序):

MODULES = [
  AbstractController::AssetPaths,
  AbstractController::Callbacks,
  AbstractController::Rendering,
  AbstractController::Translation,
  ActionView::Layouts,
  Caching,
  ConditionalGet,
  ContentSecurityPolicy,
  Cookies,
  DataStreaming,
  DefaultHeaders,
  EtagWithFlash,
  EtagWithTemplateDigest,
  Flash,
  FormBuilder,
  Helpers,
  HttpAuthentication::Basic::ControllerMethods,
  HttpAuthentication::Digest::ControllerMethods,
  HttpAuthentication::Token::ControllerMethods,
  ImplicitRender,
  Instrumentation,
  Logging,
  MimeResponds,
  ParameterEncoding,
  ParamsWrapper,
  PermissionsPolicy,
  Redirecting,
  Renderers::All,
  Rendering,
  RequestForgeryProtection,
  Rescue,
  Streaming,
  StrongParameters,
  UrlFor,
]

ActionController::API只包括这些(再次,注解被删除并按顺序排序):

MODULES = [
  AbstractController::Callbacks,
  AbstractController::Rendering,
  ApiRendering,
  BasicImplicitRender,
  ConditionalGet,
  DataStreaming,
  DefaultHeaders,
  Instrumentation,
  Logging,
  ParamsWrapper,
  Redirecting,
  Renderers::All,
  Rescue,
  StrongParameters,
  UrlFor,
]

相关问题