我想知道API中限制的所有功能,如果我们使用Base代替API,速度会有任何差异。我搜索了很多地方,以找到这两个模块之间的区别,所有我能够知道它的API是轻量级版本的基地。
zsohkypk1#
了解两者之间差异的最佳来源当然是它们在源代码中包含的模块列表。哪个ActionController::Base包含这些模块(注解已删除并按顺序排序):
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只包括这些(再次,注解被删除并按顺序排序):
ActionController::API
MODULES = [ AbstractController::Callbacks, AbstractController::Rendering, ApiRendering, BasicImplicitRender, ConditionalGet, DataStreaming, DefaultHeaders, Instrumentation, Logging, ParamsWrapper, Redirecting, Renderers::All, Rescue, StrongParameters, UrlFor, ]
1条答案
按热度按时间zsohkypk1#
了解两者之间差异的最佳来源当然是它们在源代码中包含的模块列表。
哪个
ActionController::Base
包含这些模块(注解已删除并按顺序排序):而
ActionController::API
只包括这些(再次,注解被删除并按顺序排序):