File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -701,11 +701,24 @@ verified value, which may be modified.
701701 verify_keys(values, context)
702702 return values
703703 },
704- apply: -> (records, value, _options ) {
704+ apply: -> (records, value, _options ) {
705705 records.where(' id IN (?)' , value)
706706 }
707707```
708708
709+ ``` ruby
710+ # A more complex example, showing how to filter for any overlap between the
711+ # value array and the possible_ids, using both verify and apply callables.
712+
713+ filter :possible_ids ,
714+ verify: -> (values, context) {
715+ values.map {|value | value.to_i}
716+ },
717+ apply: -> (records, value, _options ) {
718+ records.where(' possible_ids && ARRAY[?]' , value)
719+ }
720+ ```
721+
709722##### Finders
710723
711724Basic finding by filters is supported by resources. This is implemented in the ` find ` and ` find_by_key ` finder methods.
You can’t perform that action at this time.
0 commit comments