mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Ensure the adapters honor a custom root option and include meta when required
This commit is contained in:
@@ -37,10 +37,11 @@ module ActiveModel
|
||||
@result = @core.merge @hash
|
||||
end
|
||||
|
||||
if root = options.fetch(:root, serializer.json_key)
|
||||
if root
|
||||
@result = { root => @result }
|
||||
else
|
||||
@result
|
||||
end
|
||||
@result
|
||||
end
|
||||
end
|
||||
|
||||
@@ -49,4 +50,4 @@ module ActiveModel
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user