diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-02-21 13:17:38 -0300 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-02-21 13:32:34 -0300 |
commit | 953e19ecd97bad0d849f46a45cff01a057b6f9d6 (patch) | |
tree | 2e9aef3a11764ace1ca0255bed8bffc120dae0a8 /actionpack/lib/action_view/helpers | |
parent | 1323374333a2e3856f4a2bad7b04fdcdfce23f6f (diff) | |
download | rails-953e19ecd97bad0d849f46a45cff01a057b6f9d6.tar.gz rails-953e19ecd97bad0d849f46a45cff01a057b6f9d6.tar.bz2 rails-953e19ecd97bad0d849f46a45cff01a057b6f9d6.zip |
Use Array Difference to calculate the zones array, instead of iterating
It's faster, and doesn't force us to dup the timezones array.
Diffstat (limited to 'actionpack/lib/action_view/helpers')
-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 49473dd129..c7edf3dd7e 100644 --- a/actionpack/lib/action_view/helpers/form_options_helper.rb +++ b/actionpack/lib/action_view/helpers/form_options_helper.rb @@ -560,7 +560,7 @@ module ActionView def time_zone_options_for_select(selected = nil, priority_zones = nil, model = ::ActiveSupport::TimeZone) zone_options = "".html_safe - zones = model.all.dup + zones = model.all convert_zones = lambda { |list| list.map { |z| [ z.to_s, z.name ] } } if priority_zones @@ -572,7 +572,7 @@ module ActionView zone_options.safe_concat content_tag(:option, '-------------', :value => '', :disabled => 'disabled') zone_options.safe_concat "\n" - zones.reject! { |z| priority_zones.include?(z) } + zones = zones - priority_zones end zone_options.safe_concat options_for_select(convert_zones[zones], selected) |