diff options
author | wycats <wycats@gmail.com> | 2010-03-27 04:32:08 -0700 |
---|---|---|
committer | wycats <wycats@gmail.com> | 2010-03-27 04:32:08 -0700 |
commit | 26e714d26eff2633fd33ba6f21295a376fcad091 (patch) | |
tree | c35ad4f9e50b1e57b2e6539a16b14cba0de775a9 /activesupport/lib/active_support/core_ext/time/marshal_with_utc_flag.rb | |
parent | bc4cdae3d9b8667a24b24ad4bc17ee623e84feb9 (diff) | |
download | rails-26e714d26eff2633fd33ba6f21295a376fcad091.tar.gz rails-26e714d26eff2633fd33ba6f21295a376fcad091.tar.bz2 rails-26e714d26eff2633fd33ba6f21295a376fcad091.zip |
Remove stray instance variable to resolve serialization problem [#3769 state:resolved] (ht: Joe Rafaniello)
Diffstat (limited to 'activesupport/lib/active_support/core_ext/time/marshal_with_utc_flag.rb')
-rw-r--r-- | activesupport/lib/active_support/core_ext/time/marshal_with_utc_flag.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/core_ext/time/marshal_with_utc_flag.rb b/activesupport/lib/active_support/core_ext/time/marshal_with_utc_flag.rb index 9de8157eb0..656939947c 100644 --- a/activesupport/lib/active_support/core_ext/time/marshal_with_utc_flag.rb +++ b/activesupport/lib/active_support/core_ext/time/marshal_with_utc_flag.rb @@ -7,14 +7,20 @@ if RUBY_VERSION < '1.9' alias_method :_original_load, :_load def _load(marshaled_time) time = _original_load(marshaled_time) - utc = time.instance_variable_get('@marshal_with_utc_coercion') - utc ? time.utc : time + time.instance_eval do + if defined?(@marshal_with_utc_coercion) + remove_instance_variable("@marshal_with_utc_coercion") + utc + else + self + end + end end end alias_method :_original_dump, :_dump def _dump(*args) - obj = frozen? ? dup : self + obj = dup obj.instance_variable_set('@marshal_with_utc_coercion', utc?) obj._original_dump(*args) end |