mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-24 23:06:50 +00:00
Merge pull request #424 from cball/update-association-key-in-readme
Update README to reflect override of json key in associations
This commit is contained in:
commit
74d19e7d76
@ -386,7 +386,7 @@ class PostSerializer < ActiveModel::Serializer
|
|||||||
attributes :id, :title, :body
|
attributes :id, :title, :body
|
||||||
|
|
||||||
# look up comments, but use +my_comments+ as the key in JSON
|
# look up comments, but use +my_comments+ as the key in JSON
|
||||||
has_many :comments, key: :my_comments
|
has_many :comments, root: :my_comments
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user