ruby – 如何设置mysql2 timezone选项以删除查询警告
发布时间:2020-12-16 21:16:44 所属栏目:百科 来源:网络整理
导读:当使用 mysql2进行查询时,我总是收到警告 /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6/lib/active_record/connection_adapters/mysql2_adapter.rb:463: warning: :database_timezone option must be :utc or :local - defaulting to :local 我确实看
当使用
mysql2进行查询时,我总是收到警告
/usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.2.6/lib/active_record/connection_adapters/mysql2_adapter.rb:463: warning: :database_timezone option must be :utc or :local - defaulting to :local 我确实看到了Timezones的一个选项 Mysql2现在支持两个时区选项: :database_timezone - this is the timezone Mysql2 will assume fields are already stored as,and will use this when creating the initial Time objects in ruby :application_timezone - this is the timezone Mysql2 will convert to before finally handing back to the caller 有谁知道,如何使用,以及在哪里设置此选项? 谢谢. 解决方法
这是我修复它的方式:
config.active_record.default_timezone = :utc (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |