mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-22 22:06:50 +00:00
List out the event names to avoid garbage
This commit is contained in:
parent
a025f1b6f6
commit
2130cdfc00
@ -116,6 +116,7 @@ module ActiveModel
|
|||||||
#
|
#
|
||||||
class Serializer
|
class Serializer
|
||||||
INCLUDE_METHODS = {}
|
INCLUDE_METHODS = {}
|
||||||
|
INSTRUMENT = { :serialize => :"serialize.serializer", :associations => :"associations.serializer" }
|
||||||
|
|
||||||
class IncludeError < StandardError
|
class IncludeError < StandardError
|
||||||
attr_reader :source, :association
|
attr_reader :source, :association
|
||||||
@ -607,7 +608,8 @@ module ActiveModel
|
|||||||
# Use ActiveSupport::Notifications to send events to external systems.
|
# Use ActiveSupport::Notifications to send events to external systems.
|
||||||
# The event name is: name.class_name.serializer
|
# The event name is: name.class_name.serializer
|
||||||
def instrument(name, payload = {}, &block)
|
def instrument(name, payload = {}, &block)
|
||||||
ActiveSupport::Notifications.instrument("#{name}.serializer", payload, &block)
|
event_name = INSTRUMENT[name]
|
||||||
|
ActiveSupport::Notifications.instrument(event_name, payload, &block)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user