diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2010-06-28 14:01:48 -0300 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-06-28 19:35:33 +0200 |
commit | b2633f9f9323f5d5eca1c2c94bb7ae88ad276cda (patch) | |
tree | 4995b1f679178161d154f0b901f0f936e9737228 /activesupport/lib/active_support/values | |
parent | 97a92a4cfddf819357ca09b4a91a5937b044e4d8 (diff) | |
download | rails-b2633f9f9323f5d5eca1c2c94bb7ae88ad276cda.tar.gz rails-b2633f9f9323f5d5eca1c2c94bb7ae88ad276cda.tar.bz2 rails-b2633f9f9323f5d5eca1c2c94bb7ae88ad276cda.zip |
Don't store incorrect values in zones_map
[#4942 state:committed]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activesupport/lib/active_support/values')
-rw-r--r-- | activesupport/lib/active_support/values/time_zone.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/values/time_zone.rb b/activesupport/lib/active_support/values/time_zone.rb index 0a08016522..05b40298d3 100644 --- a/activesupport/lib/active_support/values/time_zone.rb +++ b/activesupport/lib/active_support/values/time_zone.rb @@ -350,7 +350,11 @@ module ActiveSupport def [](arg) case arg when String - zones_map[arg] ||= lookup(arg) + begin + zones_map[arg] ||= lookup(arg).tap { |tz| tz.utc_offset } + rescue TZInfo::InvalidTimezoneIdentifier + nil + end when Numeric, ActiveSupport::Duration arg *= 3600 if arg.abs <= 13 all.find { |z| z.utc_offset == arg.to_i } |