Skip to content

Commit 9d68796

Browse files
committed
Clarify filter apply callable documentation with value explanation
1 parent dcc1131 commit 9d68796

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,9 +656,14 @@ apply that filter. The callable is passed the `records`, which is an `ActiveReco
656656

657657
This example shows how you can implement different approaches for different filters.
658658

659+
Note: When a filter is not supplied a `verify` callable to modify the `value` that the `apply callable recieves,
660+
`value` defaults to an array of the string values provided to the filter parameter.
661+
659662
```ruby
663+
# When given the following parameter:'filter[visibility]': 'public'
664+
660665
filter :visibility, apply: ->(records, value, _options) {
661-
records.where('users.publicly_visible = ?', value == :public)
666+
records.where('users.publicly_visible = ?', value[0] == 'public')
662667
}
663668
```
664669

0 commit comments

Comments
 (0)