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


76
77
78
79
80
81
# File 'lib/active_model_serializers/logging.rb', line 76

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

#notify_render_payloadObject


83
84
85
86
87
88
# File 'lib/active_model_serializers/logging.rb', line 83

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