Skip to content

Commit 5ba403a

Browse files
committed
Merge pull request #616 from cball/cball-operations-processor-example
Add create_operations_processor override example
2 parents 9caf694 + 6e5b779 commit 5ba403a

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
@@ -1097,6 +1097,14 @@ JSONAPI.configure do |config|
10971097
end
10981098
```
10991099
1100+
To use a specific `OperationsProcessor` in a `ResourceController`, override the `create_operations_processor` method:
1101+
1102+
```ruby
1103+
def create_operations_processor
1104+
CountingActiveRecordOperationsProcessor.new
1105+
end
1106+
```
1107+
11001108
The callback code will be called after each find. It will use the same options as the find operation, without the
11011109
pagination, to collect the record count. This is stored in the `operation_meta`, which will be returned in the top level
11021110
meta element.

0 commit comments

Comments
 (0)