Finally, we’re resolving that scope,
returning the full dataset for now. The contract of #resolve is to
return an array of model instances, hence DATA.map { |d| Post.new(d)
}.
@@ -298,7 +298,7 @@
These are the overrides for persistence operations. You are encouraged
not to override create/update/destroy directly and instead use
-Persistence Lifecycle Hooks.
Requesting big collections can result into slow responses sometimes. In order to avoid this, you could use pagination. It’ll break your response into smaller pieces that will make your server responds faster. Paginations links can be present in your response in the following ways:
The schema flag is not affected by only/except options.
+
The schema flag is not affected by only/except options.
This option determines if the attribute is exported to the schema.json.
You might want to allow behavior only if a certain condition is met.
@@ -771,7 +771,7 @@
If a filter is marked single: true, we’ll avoid any array parsing and
escape the value for you, filtering on the string as given.
-
By default a value that comes in as null is treated as a string "null".
+
By default a value that comes in as null is treated as a string "null".
To coerce null to a Ruby nil mark the filter with allow_nil: true.
This can be changed for all attributes by setting filters_accept_nil_by_default
# app/models/employee.rbhas_many:positions
-has_one:current_position,->{where(historical_index: 1)}
+has_one:current_position,->{where(historical_index: 1)},class_name: 'Position'Employee.includes('current_position').to_a
diff --git a/guides/concepts/links.md b/guides/concepts/links.md
index c73995d..98556a4 100644
--- a/guides/concepts/links.md
+++ b/guides/concepts/links.md
@@ -14,6 +14,7 @@ Links
* [Autolinking](#autolinking)
* [Endpoint Validation](#endpoint-validation)
* [Links-On-Demand](#links-on-demand)
+ * [Pagination Links](#pagination-links)
* [Custom Endpoint URLs](#custom-endpoint-urls)
@@ -225,7 +226,33 @@ Graphiti.configure do |c|
end
{% endhighlight %}
-{% include h.html tag="h3" text="3.4 Custom Endpoint URLs" a="custom-endpoint-urls" %}
+{% include h.html tag="h3" text="3.4 Pagination Links" a="pagination-links" %}
+
+Requesting big collections can result into slow responses sometimes. In order to avoid this, you could use [pagination](https://jsonapi.org/format/#fetching-pagination). It'll break your response into smaller pieces that will make your server responds faster. Paginations links can be present in your response in the following ways:
+
+{% include h.html tag="h4" text="3.4.1 Showing by default" a="pagination-links-showing-by-default" %}
+
+With this configuration, all the responses will return the pagination links
+
+{% highlight ruby %}
+Graphiti.configure do |c|
+ c.pagination_links = true
+end
+{% endhighlight %}
+
+{% include h.html tag="h4" text="3.4.2 When requested" a="pagination-links-when-requested" %}
+
+You can showing the pagination links when it was requested in the URL with `?pagination_links=true`
+
+{% highlight ruby %}
+Graphiti.configure do |c|
+ c.pagination_links_on_demand = true
+end
+{% endhighlight %}
+
+Pagination links won't show up for *#show* actions.
+
+{% include h.html tag="h3" text="3.5 Custom Endpoint URLs" a="custom-endpoint-urls" %}
To change the URL associated with a Resource: