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:Â http://github.com/rails/rails/commit/4817bf94d135c44ddfae1a30acb15de989e3c86c#comment_52435
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.

[email protected]:~/dev/191test $ ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]
[email protected]:~/dev/191test $ cat Gemfile
git ‘git://github.com/rails/rails.git’, ‘ref’ =>
‘a4111bbca0884e4a748ab32ba7d7b550ec8d9186’
gem ‘activesupport’, ‘~> 3.0.0.beta1’, :require => ‘active_support’
[email protected]:~/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.
[email protected]:~/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:
[email protected]:~/dev/191test $ ruby -v
ruby 1.9.1p420 (2010-02-04 revision 26571) [x86_64-linux]
[email protected]:~/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.
[email protected]:~/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:

[email protected]:~/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]
[email protected]:~/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.
[email protected]:~/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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs