aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/values/time_zone.rb
diff options
context:
space:
mode:
authorAndrew White <pixeltrix@users.noreply.github.com>2018-02-19 12:30:47 +0000
committerGitHub <noreply@github.com>2018-02-19 12:30:47 +0000
commit0d41a76d0c693000005d79456dee7f9299f5e8d4 (patch)
tree4f4833dddfe790d4832ed5a1c12311ab54e93da0 /activesupport/lib/active_support/values/time_zone.rb
parentf712ef27c55fc4210a722d447e05271adef1e57f (diff)
parent2d95956e8b564236f0c5f98ea18d8535b05344f0 (diff)
downloadrails-0d41a76d0c693000005d79456dee7f9299f5e8d4.tar.gz
rails-0d41a76d0c693000005d79456dee7f9299f5e8d4.tar.bz2
rails-0d41a76d0c693000005d79456dee7f9299f5e8d4.zip
Merge pull request #32052 from rails/fix-country-zones-with-multiple-mappings
Return all mappings for a timezone id in country_zones
Diffstat (limited to 'activesupport/lib/active_support/values/time_zone.rb')
-rw-r--r--activesupport/lib/active_support/values/time_zone.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/values/time_zone.rb b/activesupport/lib/active_support/values/time_zone.rb
index 1de4748a46..9dfaddb825 100644
--- a/activesupport/lib/active_support/values/time_zone.rb
+++ b/activesupport/lib/active_support/values/time_zone.rb
@@ -267,11 +267,14 @@ module ActiveSupport
country = TZInfo::Country.get(code)
country.zone_identifiers.map do |tz_id|
if MAPPING.value?(tz_id)
- self[MAPPING.key(tz_id)]
+ MAPPING.inject([]) do |memo, (key, value)|
+ memo << self[key] if value == tz_id
+ memo
+ end
else
create(tz_id, nil, TZInfo::Timezone.new(tz_id))
end
- end.sort!
+ end.flatten(1).sort!
end
def zones_map