# 1.9 bug?

**URL:** <https://www.ruby-forum.com/t/1-9-bug/150725>\
**Category:** Ruby\
**Created:** [October 12, 2008, 4:44am UTC](https://www.ruby-forum.com/t/1-9-bug/150725 "2008-10-12T04:44:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rogerdpack](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/45deac/32.png) [@rogerdpack](https://www.ruby-forum.com/u/rogerdpack)\
**Post date:** [October 12, 2008, 4:44am UTC](https://www.ruby-forum.com/t/1-9-bug/150725/1 "2008-10-12T04:44:09Z")

</div>

here’s a function

```
  def rubygems_version
     Gem::RubyGemsVersion if defined? Gem::RubyGemsVersion
   end

```

1.8.6  
irb(main):005:0\* rubygems\_version  
=\> “1.3.0”

1.9

irb(main):001:0\> def rubygems\_version  
irb(main):002:1\> Gem::RubyGemsVersion if defined?  
Gem::RubyGemsVersion  
irb(main):003:1\> end  
=\> nil

hmm.

I guess it’s because of the way that 1.9 ‘auto integrates’ gems?

irb19

> > defined? Gem::RubyGemsVersion  
> > =\> nil
> 
> > require ‘rubygems’  
> > =\> false
> 
> > defined? Gem::RubyGemsVersion  
> > =\> nil
> 
> > Gem::RubyGemsVersion  
> > =\> “1.3.0”
> 
> > defined? Gem::RubyGemsVersion  
> > =\> “constant”

After this point the rubygems\_version method works in 1.9

-=R

---

<div class="post-metadata">

**Author:** ![rogerdpack](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/45deac/32.png) [@rogerdpack](https://www.ruby-forum.com/u/rogerdpack)\
**Post date:** [October 12, 2008, 4:48am UTC](https://www.ruby-forum.com/t/1-9-bug/150725/2 "2008-10-12T04:48:20Z")

</div>

Another 1.9 gems difference [?]

/Users/rogerpack/dev/ruby\_19\_installed/lib/ruby/gems/1.9.0/gems/rails-2.1.0/lib/rails/plugin/locator.rb:81:in  
`map': private method`specification’ called for  
#Rails::GemDependency:0x139ba24 (NoMethodError)

doesn’t happen in 1.8  
(both with gems v 1.3)

Thanks.  
-=R

---

<div class="post-metadata">

**Author:** ![rogerdpack](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/45deac/32.png) [@rogerdpack](https://www.ruby-forum.com/u/rogerdpack)\
**Post date:** [October 13, 2008, 8:33am UTC](https://www.ruby-forum.com/t/1-9-bug/150725/3 "2008-10-13T08:33:17Z")

</div>

> =\> “1.3.0”
> 
> > > defined? Gem::RubyGemsVersion  
> > > =\> “constant”
> 
> After this point the rubygems\_version method works in 1.9

I’ve seen this too; it’s especially annoying as it stops rails from  
booting out of the box.

The fix is easy though. In boot.rb, change:  
unless rubygems\_version \>= ‘0.9.4’  
into:  
unless (rubygems\_version || Gem::RubyGemsVersion) \>= ‘0.9.4’

I’d be very interested in hearing the explanation for this weird  
behaviour!

---

<div class="post-metadata">

**Author:** ![rogerdpack](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/45deac/32.png) [@rogerdpack](https://www.ruby-forum.com/u/rogerdpack)\
**Post date:** [October 14, 2008, 8:43am UTC](https://www.ruby-forum.com/t/1-9-bug/150725/4 "2008-10-14T08:43:33Z")

</div>

On Oct 11, 2008, at 19:41 PM, Roger P. wrote:

> =\> “1.3.0”
> 
> > > defined? Gem::RubyGemsVersion  
> > > =\> “constant”
> 
> After this point the rubygems\_version method works in 1.9

Something seems to be preventing defined?'s const\_missing from being  
handled properly. I’ll look into it.
