I’m migrating all my code from 1.8.7 to 1.9.2 and now when I run
something like:
DateTime.now.strftime("%Y%m")
I get the error: uninitialized constant Object::DateTime (NameError)
I’m migrating all my code from 1.8.7 to 1.9.2 and now when I run
something like:
DateTime.now.strftime("%Y%m")
I get the error: uninitialized constant Object::DateTime (NameError)
I found out that it is necessary now to include
require ‘date’
Mario R. wrote in post #1028682:
I’m migrating all my code from 1.8.7 to 1.9.2 and now when I run
something like:
DateTime.now.strftime("%Y%m")I get the error: uninitialized constant Object::DateTime (NameError)
On 10/26/2011 14:23, Mario R. wrote:
I found out that it is necessary now to include
require ‘date’
I get that error in 1.8.7 as well unless I require date.rb:
$ ruby -v -e ‘puts DateTime.now.strftime("%Y%m")’
ruby 1.8.7 (2008-08-11 patchlevel 72) [i386-cygwin]
-e:1: uninitialized constant DateTime (NameError)
$ ruby -v -rdate -e ‘puts DateTime.now.strftime("%Y%m")’
ruby 1.8.7 (2008-08-11 patchlevel 72) [i386-cygwin]
201110
You probably lost your require statement somewhere along the way. Maybe
a new version of a third party library you use no longer requires it in
for you.
-Jeremy
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs