Skip to content

Commit 90c7005

Browse files
committed
Don't store the root as we don't need it elsewhere
1 parent b695180 commit 90c7005

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

lib/active_model/serializer/adapter/json_api.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,14 @@ def initialize(serializer, options = {})
1616
end
1717

1818
def serializable_hash(options = {})
19-
@root = :data
20-
2119
if serializer.respond_to?(:each)
22-
@hash[@root] = serializer.map do |s|
23-
self.class.new(s, @options.merge(top: @top, fieldset: @fieldset)).serializable_hash[@root]
20+
@hash[:data] = serializer.map do |s|
21+
self.class.new(s, @options.merge(top: @top, fieldset: @fieldset)).serializable_hash[:data]
2422
end
2523
else
2624
@hash = cached_object do
27-
@hash[@root] = attributes_for_serializer(serializer, @options)
28-
add_resource_links(@hash[@root], serializer)
25+
@hash[:data] = attributes_for_serializer(serializer, @options)
26+
add_resource_links(@hash[:data], serializer)
2927
@hash
3028
end
3129
end

0 commit comments

Comments
 (0)