Action Controller Instrumentation¶ ↑
为 ActionController::Base 的多个端点添加了检测。它还提供了与 `process_action` 相关的一些钩子。这允许像 Active Record 和/或 DataMapper 这样的 ORM 插入 ActionController 并显示相关信息。
请参阅 ActiveRecord::Railties::ControllerRuntime 作为示例。
命名空间
方法
实例公共方法
redirect_to(*) Link
# File actionpack/lib/action_controller/metal/instrumentation.rb, line 49 def redirect_to(*) ActiveSupport::Notifications.instrument("redirect_to.action_controller", request: request) do |payload| result = super payload[:status] = response.status payload[:location] = response.filtered_location result end end
render(*) Link
send_data(data, options = {}) Link
send_file(path, options = {}) Link
实例私有方法
append_info_to_payload(payload) Link
每次操作处理完毕后,都会调用此方法并将 payload 传递给它,以便您可以添加更多信息。