Skip to content

Commit 88f5101

Browse files
committed
README.md and UPGRADE.md update for ruby-grape#543, ruby-grape#545
1 parent 5b51c90 commit 88f5101

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,9 @@ end
374374
```
375375

376376
Parameters can be nested using `group` or by calling `requires` or `optional` with a block.
377+
With a block, `group`, `requires` and `optional` accept an additional option `type` which can
378+
be either `Array` or `Hash`, and defaults to `Array`. Depending on the value, the nested
379+
parameters will be treated either as values of a hash or as values of hashes in an array.
377380
In the above example, this means `params[:media][:url]` is required along with `params[:id]`,
378381
and `params[:audio][:format]` is required only if `params[:audio]` is present.
379382

UPGRADE.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Upgrading
2+
3+
## upgrading to 0.6.2
4+
5+
In grape <= 0.6.1, `group`, `optional` and `requires` with block accepted
6+
either an Array or a Hash.
7+
8+
In grape 0.6.2, these have an additional `type` attribute which defaults
9+
to `Array`. This means that without a `type` attribute, these nested parameters
10+
will no longer accept a single hash, only an array (of hashes).

0 commit comments

Comments
 (0)