mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 15:23:06 +00:00
Explicitly set serializer for associations
Document specifying serializer for assocaition
This commit is contained in:
@@ -18,7 +18,6 @@ module ActiveModel
|
||||
end
|
||||
else
|
||||
@hash[@root] = attributes_for_serializer(serializer, @options)
|
||||
|
||||
add_resource_links(@hash[@root], serializer)
|
||||
end
|
||||
|
||||
@@ -46,7 +45,7 @@ module ActiveModel
|
||||
resource[:links] ||= {}
|
||||
resource[:links][name] = nil
|
||||
|
||||
if serializer
|
||||
if serializer && serializer.object
|
||||
type = serialized_object_type(serializer)
|
||||
if name.to_s == type || !type
|
||||
resource[:links][name] = serializer.id.to_s
|
||||
|
||||
Reference in New Issue
Block a user