mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-24 06:46:50 +00:00
Don't store the root as we don't need it elsewhere
This commit is contained in:
parent
b6951809b0
commit
90c7005c79
@ -16,16 +16,14 @@ module ActiveModel
|
|||||||
end
|
end
|
||||||
|
|
||||||
def serializable_hash(options = {})
|
def serializable_hash(options = {})
|
||||||
@root = :data
|
|
||||||
|
|
||||||
if serializer.respond_to?(:each)
|
if serializer.respond_to?(:each)
|
||||||
@hash[@root] = serializer.map do |s|
|
@hash[:data] = serializer.map do |s|
|
||||||
self.class.new(s, @options.merge(top: @top, fieldset: @fieldset)).serializable_hash[@root]
|
self.class.new(s, @options.merge(top: @top, fieldset: @fieldset)).serializable_hash[:data]
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@hash = cached_object do
|
@hash = cached_object do
|
||||||
@hash[@root] = attributes_for_serializer(serializer, @options)
|
@hash[:data] = attributes_for_serializer(serializer, @options)
|
||||||
add_resource_links(@hash[@root], serializer)
|
add_resource_links(@hash[:data], serializer)
|
||||||
@hash
|
@hash
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user