mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 06:16:50 +00:00
Document inclusion of belongs_to ActiveRecord associations
This commit is contained in:
parent
55ef0f9cbd
commit
01d1228772
@ -15,7 +15,7 @@ development.**
|
|||||||
|
|
||||||
# Installing Serializers
|
# Installing Serializers
|
||||||
|
|
||||||
The easiest way to install `ActiveModel::Serializers` is to add it to your
|
The easiest way to install `ActiveModel::Serializers` is to add it to your
|
||||||
`Gemfile`:
|
`Gemfile`:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
@ -408,6 +408,8 @@ You may also use the `:serializer` option to specify a custom serializer class a
|
|||||||
has_one :reviewer, :polymorphic => true
|
has_one :reviewer, :polymorphic => true
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Serializers are only concerned with multiplicity, and not ownership. `belongs_to` ActiveRecord associations can be included using `has_one` in your serializer.
|
||||||
|
|
||||||
## 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