aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/form_options_helper.rb
diff options
context:
space:
mode:
authorBrian McManus <bdmac97@gmail.com>2013-03-27 14:03:49 -0700
committerBrian McManus <bdmac97@gmail.com>2013-03-27 14:10:25 -0700
commit1cc991bef8687bd2d8ff0473c08709f7ee916885 (patch)
tree7152ed57c81b085df40f0b1295e8fb7d69da48e7 /actionpack/lib/action_view/helpers/form_options_helper.rb
parent57fbcc524780ce386241c8def372984583e585d6 (diff)
downloadrails-1cc991bef8687bd2d8ff0473c08709f7ee916885.tar.gz
rails-1cc991bef8687bd2d8ff0473c08709f7ee916885.tar.bz2
rails-1cc991bef8687bd2d8ff0473c08709f7ee916885.zip
Revert grep to select since they are not the same
A previous commit swapped out a call to select for a call to grep in time_zone_options_for_select. This behavior actually causes the regexp priority option to stop working. ActiveSupport::TimeZone overrides the =~ operator which is what the select block was using previously. Enumerable#grep checks pattern === element and in this case that would be /US/ === ActiveSupport::TimeZone which does not work because ActiveSupport::TimeZone does not supply an implicit converting to_str method, only an explicit to_s method. It would be impossible to provide a to_str method that behaves identically to the =~ method provided on ActiveSupport::TimeZone so the only option is to revert back to using select with =~.
Diffstat (limited to 'actionpack/lib/action_view/helpers/form_options_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/form_options_helper.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/form_options_helper.rb b/actionpack/lib/action_view/helpers/form_options_helper.rb
index 377819a80c..c7edf3dd7e 100644
--- a/actionpack/lib/action_view/helpers/form_options_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_options_helper.rb
@@ -565,7 +565,7 @@ module ActionView
if priority_zones
if priority_zones.is_a?(Regexp)
- priority_zones = zones.grep(priority_zones)
+ priority_zones = zones.select { |z| z =~ priority_zones }
end
zone_options.safe_concat options_for_select(convert_zones[priority_zones], selected)