From 6e5b779609c0d239da8b3e9d102eb272c675d526 Mon Sep 17 00:00:00 2001 From: Chris Ball Date: Mon, 15 Feb 2016 17:30:44 -0500 Subject: [PATCH] Add create_operations_processor override example --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index da2db61dc..a11bf3b6a 100644 --- a/README.md +++ b/README.md @@ -1018,6 +1018,14 @@ JSONAPI.configure do |config| end ``` +To use a specific `OperationsProcessor` in a `ResourceController`, override the `create_operations_processor` method: + +```ruby +def create_operations_processor + CountingActiveRecordOperationsProcessor.new +end +``` + The callback code will be called after each find. It will use the same options as the find operation, without the pagination, to collect the record count. This is stored in the `operation_meta`, which will be returned in the top level meta element.