Skip to content

Commit 5b90b2c

Browse files
author
Maciej Pankanin
committed
Update README.md about values validator used with allow_blank
1 parent d37d471 commit 5b90b2c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,6 +1530,14 @@ end
15301530

15311531
While Procs are convenient for single cases, consider using [Custom Validators](#custom-validators) in cases where a validation is used more than once.
15321532

1533+
Note that [allow_blank](#allow_blank) validator applies while using `:values`. In the following example the absence of `:allow_blank` does not prevent `:state` from receiving blank values because `:allow_blank` defaults to `true`.
1534+
1535+
```ruby
1536+
params do
1537+
requires :state, type: Symbol, values: [:active, :inactive]
1538+
end
1539+
```
1540+
15331541
#### `except_values`
15341542

15351543
Parameters can be restricted from having a specific set of values with the `:except_values` option.

0 commit comments

Comments
 (0)