mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 06:16:50 +00:00
commit
605408005f
@ -521,7 +521,7 @@ to `comments` underneath a `links` key:
|
|||||||
class PostSerializer < ActiveModel::Serializer
|
class PostSerializer < ActiveModel::Serializer
|
||||||
attributes :id, :title, :body
|
attributes :id, :title, :body
|
||||||
|
|
||||||
has_many :comments, embed: ids, embed_namespace: :links
|
has_many :comments, embed: :ids, embed_namespace: :links
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -612,7 +612,7 @@ the root document (say, `linked`), you can specify an `embed_in_root_key`:
|
|||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
class PostSerializer < ActiveModel::Serializer
|
class PostSerializer < ActiveModel::Serializer
|
||||||
embed: ids, include: true, embed_in_root_key: :linked
|
embed :ids, include: true, embed_in_root_key: :linked
|
||||||
|
|
||||||
attributes: :id, :title, :body
|
attributes: :id, :title, :body
|
||||||
has_many :comments, :tags
|
has_many :comments, :tags
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user