We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent af72e46 commit fb586f2Copy full SHA for fb586f2
1 file changed
README.md
@@ -280,6 +280,25 @@ class ContactResource < JSONAPI::Resource
280
end
281
```
282
283
+##### Default Filters
284
+
285
+A default filter may be defined for a resource using the `default` option on the `filter` method. This default is used
286
+unless the request overrides this value.
287
288
+For example:
289
290
+```ruby
291
+ class CommentResource < JSONAPI::Resource
292
+ attributes :body, :status
293
+ has_one :post
294
+ has_one :author
295
296
+ filter :status, default: 'published,pending'
297
+end
298
+```
299
300
+The default value is used as if it came from the request.
301
302
##### Finders
303
304
Basic finding by filters is supported by resources. This is implemented in the `find` and `find_by_key` finder methods.
0 commit comments