Skip to content

Commit 6b30eaa

Browse files
committed
polymorphic instructions
1 parent c55f8f6 commit 6b30eaa

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,19 @@ def private_attributes
4444
end
4545
```
4646

47+
## Polymorphic Attributes
48+
If you are using polymorphic relationships your serializer will have a line like:
49+
```ruby
50+
belongs_to :commentable, :polymorphic => true
51+
```
52+
53+
You can define a method in the serlializer to define what the available types will be.
54+
```ruby
55+
def commentable_types
56+
[Article, Event, Photo]
57+
end
58+
```
59+
4760
## Usage
4861

4962
install initializers

0 commit comments

Comments
 (0)