未验证 提交 af420914 编写于 作者: R Ryuta Kamizono 提交者: GitHub

Merge pull request #40151 from kamipo/return_time_after_save

Should not accidentally return decorated time object after `changes_applied`
......@@ -16,6 +16,16 @@ def serialize(value)
value
end
end
private
def cast_value(value)
case value = super
when Value
value.__getobj__
else
value
end
end
end
end
end
......@@ -11,11 +11,17 @@ def test_default_year_is_correct
topic = Topic.new(bonus_time: { 4 => 10, 5 => 30 })
assert_equal expected_time, topic.bonus_time
assert_instance_of ::Time, topic.bonus_time
topic.save!
assert_equal expected_time, topic.bonus_time
assert_instance_of ::Time, topic.bonus_time
topic.reload
assert_equal expected_time, topic.bonus_time
assert_instance_of ::Time, topic.bonus_time
end
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册