From 63cf23c476af4a3b1eb36dda692ed97ad8e61f9f Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Sun, 28 Mar 2010 17:53:16 -0300 Subject: [PATCH] Time marshalling backported [#4286 state:committed] --- activesupport/lib/active_support/core_ext/time.rb | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) diff --git a/activesupport/lib/active_support/core_ext/time.rb b/activesupport/lib/active_support/core_ext/time.rb index a8feb1a..61e4894 100644 --- a/activesupport/lib/active_support/core_ext/time.rb +++ b/activesupport/lib/active_support/core_ext/time.rb @@ -15,14 +15,18 @@ class Time alias_method :_original_load, :_load def _load(marshaled_time) time = _original_load(marshaled_time) - utc = time.send(:remove_instance_variable, '@marshal_with_utc_coercion') if time.instance_variable_defined?('@marshal_with_utc_coercion') - utc ? time.utc : time + time.instance_eval do + if defined?(@marshal_with_utc_coercion) + val = remove_instance_variable("@marshal_with_utc_coercion") + end + val ? utc : self + end end end - + alias_method :_original_dump, :_dump def _dump(*args) - obj = self.dup + obj = dup obj.instance_variable_set('@marshal_with_utc_coercion', utc?) obj._original_dump(*args) end -- 1.7.0