Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ exclude:

github:
url: 'https://www.graphiti.dev'
#url: 'http://localhost:4000'
# url: 'http://localhost:4000'
defaults:
- scope:
path: "assets/img"
Expand Down
10 changes: 10 additions & 0 deletions guides/concepts/resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,16 @@ end
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"`.
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`

{% highlight ruby %}
class PostResource < ApplicationResource
self.filters_accept_nil_by_default = true
end
{% endhighlight %}

{% include h.html tag="h4" text="3.6 Statistics" a="statistics" %}

Statistics are useful and common. Consider a datagrid listing posts - we might want a "Total Posts" count displayed above the grid without firing an additional request. Notably, that statistic **should** take into account filtering, but **should not** take into account pagination.
Expand Down