From 7b2dfdeab6e4ef096e4dc1fe313056f08ccf7dc5 Mon Sep 17 00:00:00 2001 From: Lisa Ugray Date: Tue, 4 Jul 2017 14:22:35 -0400 Subject: Fix `ActiveModel::Type::DateTime#serialize` `ActiveModel::Type::DateTime#serialize` should return a `Time` object so that finding by a datetime column works correctly. --- activemodel/lib/active_model/type/date_time.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'activemodel/lib') diff --git a/activemodel/lib/active_model/type/date_time.rb b/activemodel/lib/active_model/type/date_time.rb index 5cb0077e45..8ad0daa9a6 100644 --- a/activemodel/lib/active_model/type/date_time.rb +++ b/activemodel/lib/active_model/type/date_time.rb @@ -10,6 +10,10 @@ module ActiveModel :datetime end + def serialize(value) + super(cast(value)) + end + private def cast_value(value) -- cgit v1.2.3