mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 15:23:06 +00:00
Use type as key for linked resources
If type is `author` but the association is called `writer`, the linked
resource key should be called `authors`, e.g
{
...
linked: {
authors: [{
...
}]
}
...
}
This commit is contained in:
@@ -62,7 +62,7 @@ module ActiveModel
|
||||
resource_path = [parent, resource_name].compact.join('.')
|
||||
|
||||
if include_assoc?(resource_path)
|
||||
plural_name = resource_name.to_s.pluralize.to_sym
|
||||
plural_name = serialized_object_type(serializer).pluralize.to_sym
|
||||
attrs = [attributes_for_serializer(serializer, @options)].flatten
|
||||
@top[:linked] ||= {}
|
||||
@top[:linked][plural_name] ||= []
|
||||
|
||||
Reference in New Issue
Block a user