Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Don't store incorrect values in zones_map backport
[#4942 state:committed]

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information
spastorino authored and josevalim committed Jun 28, 2010
1 parent 56b35af commit 70af7ef
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion activesupport/lib/active_support/values/time_zone.rb
Expand Up @@ -387,7 +387,9 @@ def zones_map
def [](arg)
case arg
when String
zones_map[arg] ||= lookup(arg)
if tz = lookup(arg)

This comment has been minimized.

Copy link
@texel

texel Jun 28, 2010

This might not be what we want - it does a lookup (and creates a TimeZone object) regardless of whether one already exists in zone_map

This comment has been minimized.

Copy link
@spastorino

spastorino Jun 29, 2010

Author Contributor

@texel you're right please add a patch on the #4942 ticket and assign to me

This comment has been minimized.

Copy link
@texel

texel Jun 29, 2010

Done and done. Thanks!

zones_map[arg] ||= tz
end
when Numeric, ActiveSupport::Duration
arg *= 3600 if arg.abs <= 13
all.find { |z| z.utc_offset == arg.to_i }
Expand Down

0 comments on commit 70af7ef

Please sign in to comment.