aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/type/time.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/type/time.rb')
-rw-r--r--activerecord/lib/active_record/type/time.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/type/time.rb b/activerecord/lib/active_record/type/time.rb
index 70988d84ff..7da49e43c7 100644
--- a/activerecord/lib/active_record/type/time.rb
+++ b/activerecord/lib/active_record/type/time.rb
@@ -2,6 +2,18 @@ module ActiveRecord
module Type
class Time < ActiveModel::Type::Time
include Internal::Timezone
+
+ class Value < DelegateClass(::Time) # :nodoc:
+ end
+
+ def serialize(value)
+ case value = super
+ when ::Time
+ Value.new(value)
+ else
+ value
+ end
+ end
end
end
end