diff options
author | Christos Zisopoulos <christos@me.com> | 2011-07-27 16:12:22 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2011-08-13 16:22:20 -0700 |
commit | 035d31bd93d68724912d656e03cba7c6b503d25a (patch) | |
tree | 748fcbcbfcb0c09c6fb51df05cb19663162ee25e /actionpack | |
parent | 4c873cbf367d82538dbac914e7eee05b3582b6f1 (diff) | |
download | rails-035d31bd93d68724912d656e03cba7c6b503d25a.tar.gz rails-035d31bd93d68724912d656e03cba7c6b503d25a.tar.bz2 rails-035d31bd93d68724912d656e03cba7c6b503d25a.zip |
Improve performance and memory usage for options_for_select with Ruby 1.8.7
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_options_helper.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/helpers/form_options_helper.rb b/actionpack/lib/action_view/helpers/form_options_helper.rb index 7c43dc04e0..c677257d60 100644 --- a/actionpack/lib/action_view/helpers/form_options_helper.rb +++ b/actionpack/lib/action_view/helpers/form_options_helper.rb @@ -323,12 +323,12 @@ module ActionView return container if String === 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="#{ERB::Util.html_escape(value)}"#{selected_attribute}#{disabled_attribute}#{html_attributes}>#{ERB::Util.html_escape(text)}</option>) |