ruby - undefined method `zone` for Time:Class after requiring active_support/time_with_zone -
i'm on ruby 2.2.1 , have active_support 4.2 installed want use
time.zone.parse('2007-02-10 15:30:45')
as described here: http://api.rubyonrails.org/classes/activesupport/timewithzone.html
but after requiring active_support
, active_support/time_with_zone
, doesn't seem time.zone
still doesn't work. observe:
2.2.1 :002 > require "active_support" => true 2.2.1 :003 > time.zone nomethoderror: undefined method `zone' time:class 2.2.1 :004 > require "active_support/time_with_zone" => true 2.2.1 :005 > time.zone nomethoderror: undefined method `zone' time:class
what's going on?
the zone
class method time
class in active_support/core_ext/time/zones
. can require class if want use time.zone
better approach might require active_support/all
suggested solution
require "active_support/all"
if want check out source code fort active_support @ github repo
Comments
Post a Comment