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.
F8fd54072606eaf5603484e756672034?d=identicon&s=25 John Wells (Guest)
on 2006-01-13 07: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
C64e63b70be7dfed8b0742540b8b27e5?d=identicon&s=25 Mark James (Guest)
on 2006-01-13 09:18
(Received via mailing list)
John Wells 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.
F8fd54072606eaf5603484e756672034?d=identicon&s=25 John Wells (Guest)
on 2006-01-13 12:15
Mark James wrote:
> John Wells 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.