From dfd88083f85115c62da5f2cca2e0e4a8430e2b76 Mon Sep 17 00:00:00 2001 From: Leigh Caplan Date: Mon, 28 Jun 2010 15:38:16 -0700 Subject: [PATCH] Rewrite the clause to pluck the existing value from zones_map before performing a lookup. --- .../lib/active_support/values/time_zone.rb | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/activesupport/lib/active_support/values/time_zone.rb b/activesupport/lib/active_support/values/time_zone.rb index 0c39c76..ad9ea2a 100644 --- a/activesupport/lib/active_support/values/time_zone.rb +++ b/activesupport/lib/active_support/values/time_zone.rb @@ -387,8 +387,10 @@ module ActiveSupport def [](arg) case arg when String - if tz = lookup(arg) - zones_map[arg] ||= tz + if tz = zones_map[arg] + tz + elsif tz = lookup(arg) + zones_map[arg] = tz end when Numeric, ActiveSupport::Duration arg *= 3600 if arg.abs <= 13 -- 1.6.5.3