Rails 5 - created_at 和 updated_at 类

Rails 5 - created_at and updated_at classes

我在 Rails 4 和 5 之间遇到了不同的行为;具体来说,代码中模型的 created_atupdated_at 值的 class。在Rails 4中,它显示它们是ActiveSupport::TimeWithZone,但Rails 5只是将它们显示为Dateputs.

的值也(显然)以不同的方式打印出来

我没有更改这些值的数据库类型。我将 Oracle 与 activerecord-oracle_enhanced-adapter gem (v1.7.0) 一起使用,并且在 [=20= 的迁移中创建了列 "normally" ] 没有特殊配置。

» bundle exec rails c
Running via Spring preloader in process 69059
Loading development environment (Rails 4.2.7.1)
[1] (pry) main: 0> Rails.version
=> "4.2.7.1"
[2] (pry) main: 0> Document.first.created_at.class
[ SQL Omitted ]
=> ActiveSupport::TimeWithZone ←←←←←←←←←←←← HERE
[3] (pry) main: 0> puts Document.first.updated_at
[ SQL Omitted ]
2016-09-08 17:05:18 -0600 ←←←←←←←←←←←←←←←←← HERE
=> nil
[4] (pry) main: 0> !!!

» git flow feature checkout rails-5
Switched to branch 'feature/rails-5'

» bundle exec rails c
Running via Spring preloader in process 69533
Loading development environment (Rails 5.0.1)
[1] (pry) main: 0> Rails.version
=> "5.0.1"
[2] (pry) main: 0> Document.first.created_at.class
[ SQL Omitted ]
=> Date ←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←← HERE
[3] (pry) main: 0> puts Document.first.updated_at
[ SQL Omitted ]
2016-09-08 ←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←←← HERE
=> nil

他们真的改变了吗,还是我做错了什么?我错过了什么?

我在需要申请的 activerecord-oracle_enhanced-adapter documentation, but there are explicit Rails 4.2 to 5 upgrade instructions 中错过了这个。