mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-24 23:06:50 +00:00
Merge pull request #136 from garysweaver/master
Adding documentation for :serializer and :polymorphic options on associations
This commit is contained in:
commit
634f5ba91e
@ -328,6 +328,13 @@ class PostSerializer < ActiveModel::Serializer
|
|||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You may also use the `:serializer` option to specify a custom serializer class and the `:polymorphic` option to specify an association that is polymorphic (STI), e.g.:
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
has_many :comments, :serializer => CommentShortSerializer
|
||||||
|
has_one :reviewer, :polymorphic => true
|
||||||
|
```
|
||||||
|
|
||||||
## Embedding Associations
|
## Embedding Associations
|
||||||
|
|
||||||
By default, associations will be embedded inside the serialized object. So if
|
By default, associations will be embedded inside the serialized object. So if
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user