Module: ActiveModelSerializers::Logging

Extended by:
ActiveSupport::Concern
Included in:
SerializableResource
Defined in:
lib/active_model_serializers/logging.rb

Defined Under Namespace

Modules: ClassMethods, Macros Classes: LogSubscriber

Constant Summary collapse

RENDER_EVENT =
'render.active_model_serializers'.freeze

Instance Method Summary collapse

Instance Method Details

#notify_renderObject



78
79
80
81
82
83
# File 'lib/active_model_serializers/logging.rb', line 78

def notify_render(*)
  event_name = RENDER_EVENT
  ActiveSupport::Notifications.instrument(event_name, notify_render_payload) do
    yield
  end
end

#notify_render_payloadObject



85
86
87
88
89
90
# File 'lib/active_model_serializers/logging.rb', line 85

def notify_render_payload
  {
    serializer: serializer || ActiveModel::Serializer::Null,
    adapter: adapter || ActiveModelSerializers::Adapter::Null
  }
end