mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-22 22:06:50 +00:00
Update README to reflect override of json key in associations
This commit is contained in:
parent
d5308b4d0b
commit
3b9b4d728a
@ -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