Skip to content

Commit 5075436

Browse files
committed
Change :embed_key to :key
1 parent 6054080 commit 5075436

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -513,15 +513,15 @@ Now, any associations will be supplied as an Array of IDs:
513513
}
514514
```
515515

516-
You may also choose to embed the IDs by the association's name underneath an
517-
`embed_key` for the resource. For example, say we want to change `comment_ids`
516+
You may also choose to embed the IDs by the association's name underneath a
517+
`key` for the resource. For example, say we want to change `comment_ids`
518518
to `comments` underneath a `links` key:
519519

520520
```ruby
521521
class PostSerializer < ActiveModel::Serializer
522522
attributes :id, :title, :body
523523

524-
has_many :comments, embed: :ids, embed_namespace: :links
524+
has_many :comments, embed: :ids, key: :comments, embed_namespace: :links
525525
end
526526
```
527527

@@ -683,7 +683,7 @@ class PostSerializer < ActiveModel::Serializer
683683
embed :ids, include: true
684684

685685
attributes :id, :title, :body
686-
has_many :comments, embed_key: :external_id
686+
has_many :comments, key: :external_id
687687
end
688688
```
689689

0 commit comments

Comments
 (0)