Forum: Ferret uninitialized constant Ferret

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
John W. (Guest)
on 2006-01-13 08:13
I get this error message from the following code:

require 'rubygems'
require 'ferret'
include Ferret

index = Index::Index.new(:path => '/tmp/index')

index << {:title => "Programming Ruby", :content => "blah blah blah"}
index << {:title => "Programming Ruby", :content => "yada yada yada"}



Yes, gems is installed and ferret is as well. Here's the exact output:

./ferret.rb:3: uninitialized constant Ferret (NameError)
        from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
`require__'
        from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
`require'
        from test_ferret.rb:2

Any ideas what I'm doing wrong? Ruby version 1.8.2

Thanks!
John
Mark J. (Guest)
on 2006-01-13 10:18
(Received via mailing list)
John W. wrote:
>
> `require'
>         from test_ferret.rb:2
>
> Any ideas what I'm doing wrong? Ruby version 1.8.2

I think it's because you've called your file 'ferret.rb'.
It's requiring itself.
John W. (Guest)
on 2006-01-13 13:15
Mark J. wrote:
> John W. wrote:
>>
>> `require'
>>         from test_ferret.rb:2
>>
>> Any ideas what I'm doing wrong? Ruby version 1.8.2
>
> I think it's because you've called your file 'ferret.rb'.
> It's requiring itself.

Hah...so it is! I changed it in the output I posted because I thought it
might lead to confusion, but it never occurred to me that it might be
causing problems for ruby itself.

Working now...thanks!

John
This topic is locked and can not be replied to.