【发布时间】:2016-05-05 14:45:14
【问题描述】:
我正在使用 Ruby 2.2.1 并安装了 active_support 4.2,所以我想使用
Time.zone.parse('2007-02-10 15:30:45')
如此处所述:http://api.rubyonrails.org/classes/ActiveSupport/TimeWithZone.html
但即使在要求active_support 和active_support/time_with_zone 之后,我似乎仍然无法使用Time.zone。观察:
2.2.1 :002 > require "active_support"
=> true
2.2.1 :003 > Time.zone
NoMethodError: undefined method `zone' for Time:Class
2.2.1 :004 > require "active_support/time_with_zone"
=> true
2.2.1 :005 > Time.zone
NoMethodError: undefined method `zone' for Time:Class
发生了什么事?
【问题讨论】:
标签: ruby activesupport