diff options
author | Christos Zisopoulos <christos@me.com> | 2011-07-27 16:12:22 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2011-07-27 08:37:10 -0700 |
commit | 8faeed1d7174cc9c357dbf55bb55d8a1a221eaca (patch) | |
tree | a9fed2a417e7239ee81db06505634ccad430cb09 /actionpack | |
parent | 091e767c2db7a4791c4e617d40fb665ab73713cd (diff) | |
download | rails-8faeed1d7174cc9c357dbf55bb55d8a1a221eaca.tar.gz rails-8faeed1d7174cc9c357dbf55bb55d8a1a221eaca.tar.bz2 rails-8faeed1d7174cc9c357dbf55bb55d8a1a221eaca.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>) |