You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[](https://gitter.im/cerebris/jsonapi-resources?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4
4
5
-
**_NOTE: This Rails 5 branch is a work in progress. It contains some monkey patches (in `test_helper.rb`) to allow existing tests to pass with Rails 5.0.0.beta1.1_. Things may break with future changes to Rails.**
5
+
**_NOTE: There is a Rails 5 branch that is a work in progress. In addition to some changes for Rails 5 support it contains some monkey patches (in `test_helper.rb`) to allow existing tests to pass with Rails 5.0.0.beta1.1_. Things may break with future changes to Rails. If you are using RAILS 5 it is recommended that you use the rails 5 branch.**
6
6
7
7
`JSONAPI::Resources`, or "JR", provides a framework for developing a server that complies with the
8
8
[JSON API](http://jsonapi.org/) specification.
@@ -29,6 +29,7 @@ backed by ActiveRecord models or by custom objects.
@@ -787,12 +788,22 @@ The `paged` `paginator` returns results based on pages of a fixed size. Valid `p
787
788
If `number` is omitted the first page is returned. If `size` is omitted the `default_page_size` from the configuration
788
789
settings is used.
789
790
791
+
```
792
+
GET /articles?page%5Bnumber%5D=10&page%5Bsize%5D=10 HTTP/1.1
793
+
Accept: application/vnd.api+json
794
+
```
795
+
790
796
###### Offset Paginator
791
797
792
798
The `offset``paginator` returns results based on an offset from the beginning of the resultset. Valid `page` parameters
793
799
are `offset` and `limit`. If `offset` is omitted a value of 0 will be used. If `limit` is omitted the `default_page_size`
794
800
from the configuration settings is used.
795
801
802
+
```
803
+
GET /articles?page%5Blimit%5D=10&page%5Boffset%5D=10 HTTP/1.1
804
+
Accept: application/vnd.api+json
805
+
```
806
+
796
807
###### Custom Paginators
797
808
798
809
Custom `paginators` can be used. These should derive from `Paginator`. The `apply` method takes a `relation` and
@@ -931,6 +942,72 @@ method is called with an `options` has. The `options` hash will contain the foll
931
942
*`:serializer` -> the serializer instance
932
943
*`:serialization_options` -> the contents of the `serialization_options` method on the controller.
933
944
945
+
#### Custom Links
946
+
947
+
Custom links can be included for each resource by overriding the `custom_links` method. If a non empty hash is returned from `custom_links`, it will be merged with the default links hash containing the resource's `self` link. The `custom_links` method is called with the same `options` hash used by for [resource meta information](#resource-meta). The `options` hash contains the following:
948
+
949
+
*`:serializer` -> the serializer instance
950
+
*`:serialization_options` -> the contents of the `serialization_options` method on the controller.
0 commit comments