From 5d1d9bfb05dd84305369a8fc5a729d2b8ad912e2 Mon Sep 17 00:00:00 2001 From: John Allison Date: Wed, 5 Jan 2011 14:15:10 -0500 Subject: 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) --- actionpack/lib/action_view/helpers/form_options_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack/lib') 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 -- cgit v1.2.3