Skip to content

Commit e41eedd

Browse files
committed
Merge pull request #630 from sachse/readme-fix
README: Change :embed_key to :key
2 parents c19a254 + 5075436 commit e41eedd

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
@@ -524,15 +524,15 @@ Now, any associations will be supplied as an Array of IDs:
524524
}
525525
```
526526

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

531531
```ruby
532532
class PostSerializer < ActiveModel::Serializer
533533
attributes :id, :title, :body
534534

535-
has_many :comments, embed: :ids, embed_namespace: :links
535+
has_many :comments, embed: :ids, key: :comments, embed_namespace: :links
536536
end
537537
```
538538

@@ -694,7 +694,7 @@ class PostSerializer < ActiveModel::Serializer
694694
embed :ids, include: true
695695

696696
attributes :id, :title, :body
697-
has_many :comments, embed_key: :external_id
697+
has_many :comments, key: :external_id
698698
end
699699
```
700700

0 commit comments

Comments
 (0)