Permalink
Browse files

Leave the knowledge of boolean tag values to content tag

content tag already knows which tags are boolean and the values that
should generate them when a truthy value is passed, so leave this logic
for it instead of duplicating when generating options tags.
  • Loading branch information...
1 parent b973852 commit 1c4eb13345a0c771aab2ee47aecdd4b24acce43a @carlosantoniodasilva carlosantoniodasilva committed Jul 22, 2013
Showing with 3 additions and 3 deletions.
  1. +3 −3 actionview/lib/action_view/helpers/form_options_helper.rb
@@ -346,8 +346,8 @@ def options_for_select(container, selected = nil)
html_attributes = option_html_attributes(element)
text, value = option_text_and_value(element).map { |item| item.to_s }
- html_attributes[:selected] = 'selected' if option_value_selected?(value, selected)
- html_attributes[:disabled] = 'disabled' if 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)
@@ -565,7 +565,7 @@ def time_zone_options_for_select(selected = nil, priority_zones = nil, model = :
end
zone_options.safe_concat options_for_select(convert_zones[priority_zones], selected)
- zone_options.safe_concat content_tag(:option, '-------------', value: '', disabled: 'disabled')
+ zone_options.safe_concat content_tag(:option, '-------------', value: '', disabled: true)
zone_options.safe_concat "\n"
zones = zones - priority_zones

0 comments on commit 1c4eb13

Please sign in to comment.