mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 15:23:06 +00:00
Adds polymorphic tests and documentation
This commit is contained in:
@@ -76,6 +76,18 @@ def blog
|
||||
end
|
||||
```
|
||||
|
||||
### Polymorphic Relationships
|
||||
|
||||
Polymorphic relationships are serialized by specifying the relationship, like any other association. For example:
|
||||
|
||||
```ruby
|
||||
class PictureSerializer < ActiveModel::Serializer
|
||||
has_one :imageable
|
||||
end
|
||||
```
|
||||
|
||||
For more context, see the [tests](../../test/adapter/polymorphic_test.rb) for each adapter.
|
||||
|
||||
### Caching
|
||||
|
||||
#### ::cache
|
||||
|
||||
Reference in New Issue
Block a user