mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-22 22:06: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
|
||||
|
||||
def serializable_hash(options = {})
|
||||
@root = :data
|
||||
|
||||
if serializer.respond_to?(:each)
|
||||
@hash[@root] = serializer.map do |s|
|
||||
self.class.new(s, @options.merge(top: @top, fieldset: @fieldset)).serializable_hash[@root]
|
||||
@hash[:data] = serializer.map do |s|
|
||||
self.class.new(s, @options.merge(top: @top, fieldset: @fieldset)).serializable_hash[:data]
|
||||
end
|
||||
else
|
||||
@hash = cached_object do
|
||||
@hash[@root] = attributes_for_serializer(serializer, @options)
|
||||
add_resource_links(@hash[@root], serializer)
|
||||
@hash[:data] = attributes_for_serializer(serializer, @options)
|
||||
add_resource_links(@hash[:data], serializer)
|
||||
@hash
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user