在Rails通知中,我订阅了“process_action.action_controller”,并希望向有效负载添加更多属性.我怎样才能做到这一点?
我尝试过使用append_info_to_payload,但这似乎什么也没做.
module AppendExceptionPayload module ControllerRuntime extend ActiveSupport::Concern protected def append_info_to_payload(payload) super payload[:happy] = "HAPPY" end end end
订阅和上面的代码在Rails引擎中,所以我在这里调用它来添加它:
require 'append_exception_payload' module Instrument class Engine < ::Rails::Engine ActiveSupport.on_load :action_controller do include AppendExceptionPayload::ControllerRuntime end end end