mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 15:23:06 +00:00
Remove url options
Removing url options because It does not works at all. Thus, there are others PR at the moment to include url(links) as well.
This commit is contained in:
14
README.md
14
README.md
@@ -36,8 +36,6 @@ class PostSerializer < ActiveModel::Serializer
|
||||
attributes :title, :body
|
||||
|
||||
has_many :comments
|
||||
|
||||
url :post
|
||||
end
|
||||
```
|
||||
|
||||
@@ -48,8 +46,6 @@ class CommentSerializer < ActiveModel::Serializer
|
||||
attributes :name, :body
|
||||
|
||||
belongs_to :post
|
||||
|
||||
url [:post, :comment]
|
||||
end
|
||||
```
|
||||
|
||||
@@ -239,8 +235,6 @@ class PostSerializer < ActiveModel::Serializer
|
||||
|
||||
has_many :comments
|
||||
has_one :author
|
||||
|
||||
url :post
|
||||
end
|
||||
```
|
||||
|
||||
@@ -251,8 +245,6 @@ class CommentSerializer < ActiveModel::Serializer
|
||||
attributes :name, :body
|
||||
|
||||
belongs_to :post_id
|
||||
|
||||
url [:post, :comment]
|
||||
end
|
||||
```
|
||||
|
||||
@@ -274,8 +266,6 @@ And you can change the JSON key that the serializer should use for a particular
|
||||
has_many :comments, key: :reviews
|
||||
```
|
||||
|
||||
The `url` declaration describes which named routes to use while generating URLs
|
||||
for your JSON. Not every adapter will require URLs.
|
||||
## Pagination
|
||||
|
||||
Pagination links will be included in your response automatically as long as the resource is paginated using [Kaminari](https://github.com/amatsuda/kaminari) or [WillPaginate](https://github.com/mislav/will_paginate) and if you are using a ```JSON-API``` adapter.
|
||||
@@ -307,8 +297,6 @@ class PostSerializer < ActiveModel::Serializer
|
||||
attributes :title, :body
|
||||
|
||||
has_many :comments
|
||||
|
||||
url :post
|
||||
end
|
||||
```
|
||||
|
||||
@@ -332,8 +320,6 @@ class PostSerializer < ActiveModel::Serializer
|
||||
attributes :title, :body
|
||||
|
||||
has_many :comments
|
||||
|
||||
url :post
|
||||
end
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user