aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/type
diff options
context:
space:
mode:
authorLisa Ugray <lisa.ugray@shopify.com>2017-07-04 14:22:35 -0400
committerLisa Ugray <lisa.ugray@shopify.com>2017-07-05 13:10:15 -0400
commit7b2dfdeab6e4ef096e4dc1fe313056f08ccf7dc5 (patch)
treec6692d46e31c691c8218a3210cb6d4136a606da4 /activemodel/lib/active_model/type
parent2ae84d2fa09af85166f35ca44238a6a20d3c1554 (diff)
downloadrails-7b2dfdeab6e4ef096e4dc1fe313056f08ccf7dc5.tar.gz
rails-7b2dfdeab6e4ef096e4dc1fe313056f08ccf7dc5.tar.bz2
rails-7b2dfdeab6e4ef096e4dc1fe313056f08ccf7dc5.zip
Fix `ActiveModel::Type::DateTime#serialize`
`ActiveModel::Type::DateTime#serialize` should return a `Time` object so that finding by a datetime column works correctly.
Diffstat (limited to 'activemodel/lib/active_model/type')
-rw-r--r--activemodel/lib/active_model/type/date_time.rb4
1 files changed, 4 insertions, 0 deletions
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)