Action Controller Instrumentation
在 ActionController::Base
多個點加入儀器化。也提供一些跟 process_action 有關的掛勾。這樣一來,像 Active Record 和/或 DataMapper 這樣的 ORM 就可以插入 ActionController
中來顯示相關的資訊。
請參閱 ActiveRecord::Railties::ControllerRuntime 來了解範例。
命名空間
方法
實例公共方法
redirect_to(*) 連結
# 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(*) 連結
send_data(data, options = {}) 連結
send_file(path, options = {}) 連結
實例私有方法
append_info_to_payload(payload) 連結
每次處理動作之後,都會使用 payload 呼叫這個方法,因此你可以加入更多資訊。