aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaura Paredes <laura@wearepeople.io>2014-03-30 20:23:46 +0200
committerLaura Paredes <laura@wearepeople.io>2014-03-30 20:23:46 +0200
commitbe521ef6acaf13be027065e24b83461043fb0237 (patch)
tree53bb4a3bea4f49e4ea03116622ec8ac435b4266a
parentfd5739c94a6ee6ae137c946960fe1c7078404eb2 (diff)
downloadrails-be521ef6acaf13be027065e24b83461043fb0237.tar.gz
rails-be521ef6acaf13be027065e24b83461043fb0237.tar.bz2
rails-be521ef6acaf13be027065e24b83461043fb0237.zip
Do not overwrite selected and disabled attributes
-rw-r--r--actionview/lib/action_view/helpers/form_options_helper.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/actionview/lib/action_view/helpers/form_options_helper.rb b/actionview/lib/action_view/helpers/form_options_helper.rb
index f625a9ff49..48f42947db 100644
--- a/actionview/lib/action_view/helpers/form_options_helper.rb
+++ b/actionview/lib/action_view/helpers/form_options_helper.rb
@@ -360,8 +360,8 @@ module ActionView
html_attributes = option_html_attributes(element)
text, value = option_text_and_value(element).map { |item| item.to_s }
- html_attributes[:selected] = option_value_selected?(value, selected)
- html_attributes[:disabled] = disabled && option_value_selected?(value, disabled)
+ html_attributes[:selected] ||= option_value_selected?(value, selected)
+ html_attributes[:disabled] ||= disabled && option_value_selected?(value, disabled)
html_attributes[:value] = value
content_tag_string(:option, text, html_attributes)