mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 06:16:50 +00:00
Removing instrumentation_keys in order to fix the payload
See - https://github.com/rails-api/active_model_serializers/issues/2067
This commit is contained in:
parent
c54532a2ae
commit
af410c54e6
@ -64,10 +64,5 @@ module ActiveModel
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def instrumentation_keys
|
|
||||||
[:object, :scope, :root, :meta_key, :meta, :each_serializer, :resource_name, :key_format, :context]
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -21,12 +21,8 @@ module ActiveModel
|
|||||||
@wrap_in_array ? [hash] : hash
|
@wrap_in_array ? [hash] : hash
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
alias serializable_hash as_json
|
alias serializable_hash as_json
|
||||||
alias serializable_object as_json
|
alias serializable_object as_json
|
||||||
|
|
||||||
private
|
|
||||||
def instrumentation_keys
|
|
||||||
[:object, :wrap_in_array]
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -52,15 +52,8 @@ module ActiveModel
|
|||||||
end
|
end
|
||||||
|
|
||||||
def instrument(action, &block)
|
def instrument(action, &block)
|
||||||
payload = instrumentation_keys.inject({ serializer: self.class.name }) do |payload, key|
|
payload = { serializer: self.class.name }
|
||||||
payload[:payload] = self.instance_variable_get(:"@#{key}")
|
|
||||||
payload
|
|
||||||
end
|
|
||||||
ActiveSupport::Notifications.instrument("#{action}.active_model_serializers", payload, &block)
|
ActiveSupport::Notifications.instrument("#{action}.active_model_serializers", payload, &block)
|
||||||
end
|
end
|
||||||
|
|
||||||
def instrumentation_keys
|
|
||||||
[:object, :scope, :root, :meta_key, :meta, :wrap_in_array, :only, :except, :key_format]
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user