Stack level too deep

Iam new to ferret Iam trying to do a sample application on ferret
this is my code:

class SearchController < ApplicationController
require ‘ferret’
include Ferret

index = Index::Index.new(:path => ‘/path/to/index’)
def list

end
def index

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

blah"}
index << {:title => “Programming Ruby”, :content => “yada yada
yada”}
count=index.search_each(‘content:“blah”’) do |doc, score|
puts “Document #{doc} found with a score of #{score}”
end
puts count

end

end

This is wht i ended up with:

http://localhost:3000/search/index

SystemStackError in SearchController#index
stack level too deep
RAILS_ROOT: ./script/…/config/…

Application Trace | Framework Trace | Full Trace
#{RAILS_ROOT}/app/controllers/search_controller.rb:11:in index' #{RAILS_ROOT}/app/controllers/search_controller.rb:11:in index’
.
.
.

Reply please if some one know the answer

On Jun 6, 2006, at 18:04, Raghuveer Mamilla wrote:

def index

index << ...

I haven’t tried it out, but I believe that ruby is interpreting this
as a recursive call to the index method. At least, that’s what
usually creates that sort of error.

I’m not altogether familiar with rails conventions, but in the
general case I would either make ‘index’ a class (@@index) or
instance (@index) variable, which would avoid this problem. Is there
some reason it’s declared as local?

matthew smillie.