jackc / tod

Time of day and shift types for Ruby
MIT License
435 stars 56 forks source link

ActiveRecord 5.2.3 breaks 24:00:00 serialization #65

Closed jackc closed 3 years ago

jackc commented 5 years ago
  1) Failure:
TimeOfDay with ActiveRecord Serializable Attribute::.load#test_0004_dump 24:00:00 and get it back [/home/jack/dev/tod/test/tod/time_of_day_serializable_attribute_test.rb:61]:
--- expected
+++ actual
@@ -1 +1 @@
-#<Tod::TimeOfDay:0xXXXXXX @hour=24, @minute=0, @second=0, @second_of_day=86400>
+#<Tod::TimeOfDay:0xXXXXXX @hour=0, @minute=0, @second=0, @second_of_day=0>

Works fine with ActiveRecord 5.2.2. Not sure what they changed.

stevenheffner commented 5 years ago

What did you end up doing about this?

jackc commented 5 years ago

I ran into this while testing something else and recorded it here for future reference but I have not found a solution.

jackc commented 3 years ago

I just released a new version that uses ActiveRecord attributes instead of serialize. This seems to resolve this.