Skip to content

Commit

Permalink
Merge pull request #2186 from maciejpankanin/docs-values-validator-up…
Browse files Browse the repository at this point in the history
…date

Update README.md about values validator used with allow_blank
  • Loading branch information
dblock authored Aug 13, 2021
2 parents d37d471 + 5b90b2c commit 0ff93fb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1530,6 +1530,14 @@ end

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

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`.

```ruby
params do
requires :state, type: Symbol, values: [:active, :inactive]
end
```

#### `except_values`

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

0 comments on commit 0ff93fb

Please sign in to comment.