File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
lib/active_model/serializer/adapter Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -36,10 +36,11 @@ def serializable_hash(options = nil)
36
36
37
37
add_links ( options )
38
38
else
39
- @hash [ :data ] = resource_objects_for ( serializer , options )
39
+ resource_objects = resource_objects_for ( serializer , options )
40
40
relationships = relationships_for ( serializer )
41
- @hash [ :data ] [ :relationships ] = relationships if relationships . any?
42
41
included = included_for ( serializer )
42
+ @hash [ :data ] = resource_objects
43
+ @hash [ :data ] [ :relationships ] = relationships if relationships . any?
43
44
@hash [ :included ] = included if included . any?
44
45
end
45
46
@hash
@@ -109,7 +110,7 @@ def relationship_value_for(serializer, options = {})
109
110
end
110
111
111
112
def relationships_for ( serializer )
112
- serializer . associations . map { |association | [ association . key , { data : relationship_value_for ( association . serializer , association . options ) } ] } . to_h
113
+ Hash [ serializer . associations . map { |association | [ association . key , { data : relationship_value_for ( association . serializer , association . options ) } ] } ]
113
114
end
114
115
115
116
def included_for ( serializer )
You can’t perform that action at this time.
0 commit comments