Skip to content

Commit

Permalink
perofrmance trumps syntactical sugar
Browse files Browse the repository at this point in the history
  • Loading branch information
pkmiec committed Apr 29, 2011
1 parent 8dcaf4d commit 92e4cfb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions actionpack/lib/action_view/helpers/form_options_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,12 @@ def options_for_select(container, selected = nil)

container = container.to_a if Hash === container
selected, disabled = extract_selected_and_disabled(selected).map do | r |
Array.wrap(r).map(&:to_s)
Array.wrap(r).map { |item| item.to_s }
end

container.map do |element|
html_attributes = option_html_attributes(element)
text, value = option_text_and_value(element).map(&:to_s)
text, value = option_text_and_value(element).map { |item| item.to_s }
selected_attribute = ' selected="selected"' if option_value_selected?(value, selected)
disabled_attribute = ' disabled="disabled"' if disabled && option_value_selected?(value, disabled)
%(<option value="#{html_escape(value)}"#{selected_attribute}#{disabled_attribute}#{html_attributes}>#{html_escape(text)}</option>)
Expand Down

0 comments on commit 92e4cfb

Please sign in to comment.