[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Require errors for rubygems

David Naseby

11/16/2004 10:13:00 PM

When I have multiple versions of a library in Rubygems, a normal
require will fail to pick up the latest version, and I have to do a
require_gem to use the library at all. Require works perfectly if
there is only one version of the gem installed. I'm on ruby
mswin32-1.8.2, with rubygems 0.8.1.

For example:

>gem list -l activerecord
*** LOCAL GEMS ***
activerecord (1.0.0, 0.9.5, 0.9.4, 0.9.2, 0.8.1, 0.8.0, 0.7.5)
Implements the ActiveRecord pattern for ORM.

>gem list -l flexmock
*** LOCAL GEMS ***
flexmock (0.0.3)
Simple and Flexible Mock Objects for Testing


irb(main):001:0> require 'flexmock'
LoadError: No such file to load -- flexmock
from (irb):1:in `require'
from (irb):1
irb(main):002:0> require 'activerecord'
LoadError: No such file to load -- activerecord
from (irb):2:in `require'
from (irb):2
irb(main):003:0> #ok, because I haven't required Rubygems, then:
irb(main):004:0* require 'rubygems'
=> true
irb(main):005:0> require 'flexmock'
=> true
irb(main):006:0> require 'activerecord'
LoadError: No such file to load -- activerecord
from c:/languages/ruby/lib/ruby/site_ruby/1.8/rubygems/loadpath_manager.
rb:5:in `require__'
from c:/languages/ruby/lib/ruby/site_ruby/1.8/rubygems/loadpath_manager.
rb:5:in `require'
from (irb):6
irb(main):007:0> require_gem 'activerecord'
=> true


--
David Naseby
http://homepages.ihug.com.a...


1 Answer

Gavin Sinclair

11/16/2004 11:13:00 PM

0

On Wednesday, November 17, 2004, 9:12:57 AM, David wrote:

> When I have multiple versions of a library in Rubygems, a normal
> require will fail to pick up the latest version, and I have to do a
> require_gem to use the library at all. Require works perfectly if
> there is only one version of the gem installed. I'm on ruby
> mswin32-1.8.2, with rubygems 0.8.1.

> [snip the most important part - d'oh!]

That's an activerecord naming issue. The gem is called 'activerecord'
but the library (what you need to require) is 'active_record'.

require_gem loads a gem. require loads a library.

Hope it works now.

Cheers,
Gavin