Issue with DateTime#to_date in active_support

Hi,

I just got bitten by the issue explained on this link:

Has anyone else seen this? Is it possible it’s a jruby issue and not a
rails
issue? It’s not clear to me since I’m still trying to get a MRI 1.8.7
setup
check with.

Thanks

On Wed, Mar 3, 2010 at 4:52 PM, Patrik S.
[email protected] wrote:

Hi,
I just got bitten by the issue explained on this
link:Â Check for date/time methods that moved upstream in 1.9 · rails/rails@4817bf9 · GitHub
Has anyone else seen this? Is it possible it’s a jruby issue and not a rails
issue? It’s not clear to me since I’m still trying to get a MRI 1.8.7 setup
check with.

Interesting…it does look like something that could be a JRuby bug,
since I assume it works for them on MRI. Are you able to reduce it to
something simple where JRuby differs from other impls?

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Actually, seems to affect MRI 1.8.7 as well (jruby in 1.8 mode gives the
same. Examples below - I’m using a specific ref to avoid some unrelated
issues.

psundberg@lnpsprod1:~/dev/191test $ ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]
psundberg@lnpsprod1:~/dev/191test $ cat Gemfile
git ‘git://github.com/rails/rails.git’, ‘ref’ =>
‘a4111bbca0884e4a748ab32ba7d7b550ec8d9186’
gem ‘activesupport’, ‘~> 3.0.0.beta1’, :require => ‘active_support’
psundberg@lnpsprod1:~/dev/191test $ bundle install --relock
Updating git://github.com/rails/rails.git
Resolving dependencies
Installing activesupport (3.0.0.beta1) from
git://github.com/rails/rails.git (at a4111bb)
Installing builder (2.1.2) from system gems
Installing i18n (0.3.5) from system gems
Installing memcache-client (1.7.8) from system gems
Installing tzinfo (0.3.16) from system gems
Your bundle is complete!
The bundle is now locked. Use bundle show to list the gems in the
environment.
psundberg@lnpsprod1:~/dev/191test $ irb
ruby-1.8.7-p249 > DateTime.new
NameError: uninitialized constant DateTime
from (irb):1
ruby-1.8.7-p249 > require ‘.bundle/environment’
=> true
ruby-1.8.7-p249 > Bundler.require :default
=> [:default]
ruby-1.8.7-p249 > require ‘active_support/core_ext’
=> true
ruby-1.8.7-p249 > DateTime.new
=> Mon, 01 Jan -4712 00:00:00 +0000
ruby-1.8.7-p249 > DateTime.new.to_date.class
=> DateTime

On MRI 1.9.1:
psundberg@lnpsprod1:~/dev/191test $ ruby -v
ruby 1.9.1p420 (2010-02-04 revision 26571) [x86_64-linux]
psundberg@lnpsprod1:~/dev/191test $ bundle install --relock
Updating git://github.com/rails/rails.git
Resolving dependencies
Installing activesupport (3.0.0.beta1) from
git://github.com/rails/rails.git (at a4111bb)
Installing builder (2.1.2) from system gems
Installing i18n (0.3.5) from system gems
Installing memcache-client (1.7.8) from system gems
Installing tzinfo (0.3.16) from system gems
Your bundle is complete!
The bundle is now locked. Use bundle show to list the gems in the
environment.
psundberg@lnpsprod1:~/dev/191test $ irb
irb(main):001:0> DateTime.new
NameError: uninitialized constant DateTime
from (irb):1
from /dat/schurman/user-root/opt/ruby191/bin/irb:12:in `’
irb(main):002:0> require ‘.bundle/environment’
=> true
irb(main):003:0> Bundler.require :default
=> [:default]
irb(main):004:0> require ‘active_support/core_ext’
=> true
irb(main):005:0> DateTime.new
=> Mon, 01 Jan -4712 00:00:00 +0000
irb(main):006:0> Date.new.to_date.class
=> Date

I’ll follow up with the rails guys - don’t understand how this has
managed to not trip up others and it’s an old commit…

Btw, jruby --1.9 mode works as as it should:

psundberg@lnpsprod1:~/dev/jruby15test $ ruby -v
jruby 1.5.0.dev (ruby 1.8.7 patchlevel 174) (2010-03-03 c37037a) (Java
HotSpot™ 64-Bit Server VM 1.6.0_17) [amd64-java]
psundberg@lnpsprod1:~/dev/jruby15test $ bundle install --relock
Updating git://github.com/rails/rails.git
Resolving dependencies
Installing activesupport (3.0.0.beta1) from
git://github.com/rails/rails.git (at a4111bb)
Installing builder (2.1.2) from system gems
Installing i18n (0.3.5) from system gems
Installing memcache-client (1.7.8) from system gems
Installing tzinfo (0.3.16) from system gems
Your bundle is complete!
The bundle is now locked. Use bundle show to list the gems in the
environment.
psundberg@lnpsprod1:~/dev/jruby15test $ ruby --1.9 -S irb
jruby-head > DateTime.nwe
NameError: uninitialized constant DateTime
from
/home/psundberg/.rvm/rubies/jruby-head/lib/ruby/1.9/irb/ruby-token.rb:99
:in const_missing' from (irb):2:inirb_binding’
Maybe IRB bug!!
jruby-head > require ‘.bundle/environment’
=> true
jruby-head > Bundler.require :default
=> [:default]
jruby-head > require ‘active_support/core_ext’
=> true
jruby-head > DateTime.new
=> Mon, 01 Jan -4712 00:00:00 +0000
jruby-head > DateTime.new.to_date.class
=> Date

On Thu, Mar 4, 2010 at 4:05 AM, Sundberg, Patrik
[email protected] wrote:

Actually, seems to affect MRI 1.8.7 as well (jruby in 1.8 mode gives the
same. Examples below - I’m using a specific ref to avoid some unrelated
issues.
irb(main):006:0> Date.new.to_date.class

=> Date

Should this have been DateTime.new.to_date? This differs from your
1.8.7 example.

I’ll follow up with the rails guys - don’t understand how this has managed
to not trip up others and it’s an old commit…

Ok…could still be an issue somewhere in JRuby, but it’s definitely
confusing how they wouldn’t have seen it if it breaks 1.8.7 too.

Btw, jruby --1.9 mode works as as it should:

jruby-head > DateTime.new.to_date.class

 => Date

Ok.

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email