ruby - NoMethodError: undefined method `zone' for Time:Class -
how use time.zone in ruby if not using rails want time.now that's available in rails not ruby
i thought that
require 'time'
would fix , make available in ruby didn't ,
nomethoderror: undefined method `zone' time:class
you've tried use zone if class method (time.zone
) [1]. if want use class method:
1.9.3-p448 :007 > time.now.zone => "edt"
but time.now
nice way of instantiating own instance of time
[2]. you're doing (calling instance method):
1.9.3-p448 :009 > time = time.new => 2014-04-09 15:14:01 -0400 1.9.3-p448 :010 > time.zone => "edt"
[1] http://www.railstips.org/blog/archives/2009/05/11/class-and-instance-methods-in-ruby/
Comments
Post a Comment