diff options
author | Yves Senn <yves.senn@gmail.com> | 2014-07-17 17:23:47 +0200 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2014-07-17 17:28:58 +0200 |
commit | 246f07c7512eca59fb304162b1b1d7dea5eb6e64 (patch) | |
tree | 39939a40cce1e7cf3b2572b37649fd495cebe9bc /actionview | |
parent | 58427d9330ff4d189ed5bd667fdeae5a2dadc9c0 (diff) | |
download | rails-246f07c7512eca59fb304162b1b1d7dea5eb6e64.tar.gz rails-246f07c7512eca59fb304162b1b1d7dea5eb6e64.tar.bz2 rails-246f07c7512eca59fb304162b1b1d7dea5eb6e64.zip |
docs, `select` and friends with `multiple=true` include a blank string.
[Jonas Baumann & Yves Senn]
The submitted params from a select with `multiple: true` look as follows:
```
{post: {category: [""]}}
{post: {category: ["", "Category 1", "Category 2"]}}
```
This is a follow up to #1552.
Diffstat (limited to 'actionview')
-rw-r--r-- | actionview/lib/action_view/helpers/form_options_helper.rb | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/actionview/lib/action_view/helpers/form_options_helper.rb b/actionview/lib/action_view/helpers/form_options_helper.rb index 48f42947db..528e2828a1 100644 --- a/actionview/lib/action_view/helpers/form_options_helper.rb +++ b/actionview/lib/action_view/helpers/form_options_helper.rb @@ -152,11 +152,9 @@ module ActionView # To prevent this the helper generates an auxiliary hidden field before # every multiple select. The hidden field has the same name as multiple select and blank value. # - # This way, the client either sends only the hidden field (representing - # the deselected multiple select box), or both fields. Since the HTML specification - # says key/value pairs have to be sent in the same order they appear in the - # form, and parameters extraction gets the last occurrence of any repeated - # key in the query string, that works for ordinary forms. + # <b>Note:</b> The client either sends only the hidden field (representing + # the deselected multiple select box), or both fields. This means that the resulting array + # always contains a blank string. # # In case if you don't want the helper to generate this hidden field you can specify # <tt>include_hidden: false</tt> option. |