Skip to content

Commit 6e5b779

Browse files
committed
Add create_operations_processor override example
1 parent 8e85d68 commit 6e5b779

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,6 +1018,14 @@ JSONAPI.configure do |config|
10181018
end
10191019
```
10201020

1021+
To use a specific `OperationsProcessor` in a `ResourceController`, override the `create_operations_processor` method:
1022+
1023+
```ruby
1024+
def create_operations_processor
1025+
CountingActiveRecordOperationsProcessor.new
1026+
end
1027+
```
1028+
10211029
The callback code will be called after each find. It will use the same options as the find operation, without the
10221030
pagination, to collect the record count. This is stored in the `operation_meta`, which will be returned in the top level
10231031
meta element.

0 commit comments

Comments
 (0)