Merge pull request #696 from ggordon/explicit_serializer

Explicitly set serializer for associations
This commit is contained in:
Alexandre de Oliveira
2015-01-06 09:57:07 -02:00
6 changed files with 119 additions and 13 deletions

View File

@@ -221,6 +221,12 @@ The `has_many` and `belongs_to` declarations describe relationships between
resources. By default, when you serialize a `Post`, you will get its `Comment`s
as well.
You may also use the `:serializer` option to specify a custom serializer class, for example:
```ruby
has_many :comments, serializer: CommentPreviewSerializer
```
The `url` declaration describes which named routes to use while generating URLs
for your JSON. Not every adapter will require URLs.