diff options
author | John Allison <jrallison@gmail.com> | 2011-01-05 14:15:10 -0500 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2011-01-09 15:45:55 -0800 |
commit | 5d1d9bfb05dd84305369a8fc5a729d2b8ad912e2 (patch) | |
tree | d6ab2d0d751e5bac61495bc609b0044c406bc923 /actionpack/lib/action_view | |
parent | 4690bee301588b92fe8c0ae1026c14336e1be57c (diff) | |
download | rails-5d1d9bfb05dd84305369a8fc5a729d2b8ad912e2.tar.gz rails-5d1d9bfb05dd84305369a8fc5a729d2b8ad912e2.tar.bz2 rails-5d1d9bfb05dd84305369a8fc5a729d2b8ad912e2.zip |
Improve select helpers by allowing a selected value of false. This is useful when using a select helper with a boolean attribute, and the attribute is false. (e.g. f.select :allow_comments)
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_options_helper.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/form_options_helper.rb b/actionpack/lib/action_view/helpers/form_options_helper.rb index 6ac8577785..7698602022 100644 --- a/actionpack/lib/action_view/helpers/form_options_helper.rb +++ b/actionpack/lib/action_view/helpers/form_options_helper.rb @@ -533,7 +533,7 @@ module ActionView else selected = Array.wrap(selected) options = selected.extract_options!.symbolize_keys - [ options[:selected] || selected , options[:disabled] ] + [ options.include?(:selected) ? options[:selected] : selected, options[:disabled] ] end end |