Hi, I’m running the edge Typo and the latest acts_as_ferret plugin and
ferret gems (as of 11 April).
In my Content model I put acts_as_ferret :fields => [:title, :body]
In the console, I call Content.rebuild_index to index all of my existing
content. All the directories get created etc, but I get the following
error back:
Loading development environment.
Content.rebuild_index
NameError: undefined method title' for classComment’
from
./script/…/config/…/config/…/vendor/plugins/acts_as_ferret/lib/a
cts_as_ferret.rb:104:in method' from ./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/a cts_as_ferret.rb:104:intitle_to_ferret’
from
./script/…/config/…/config/…/vendor/plugins/acts_as_ferret/lib/a
cts_as_ferret.rb:103:in title_to_ferret' from ./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/a cts_as_ferret.rb:439:insend’
from
./script/…/config/…/config/…/vendor/plugins/acts_as_ferret/lib/a
cts_as_ferret.rb:439:in to_doc' from ./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/a cts_as_ferret.rb:438:ineach’
from
./script/…/config/…/config/…/vendor/plugins/acts_as_ferret/lib/a
cts_as_ferret.rb:438:in to_doc' from ./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/a cts_as_ferret.rb:217:inrebuild_index’
from
./script/…/config/…/config/…/vendor/plugins/acts_as_ferret/lib/a
cts_as_ferret.rb:217:in each' from ./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/a cts_as_ferret.rb:217:inrebuild_index’
from (irb):1
Sorry - I wasn’t clear enough. Comment is defined as:
class Comment < Content
and
class Content < ActiveRecord::Base
The contents table has fields like title, body, extended etc … so the
Comment model will have them too then. The error isn’t particular to the
:title field either … if I were to have :extended as part of the
fields list, it’ll through the same error but wrt extended.
Kasper W. wrote:
I’m not exactly sure why the error is about an undefined method for the
class Comment, when you run rebuild_index on Content.
Does Comment have the fields ‘title’ and ‘body’ defined somewhere?
Didn’t you mean Comment.rebuild_index?
Joerg D. wrote:
In my Content model I put acts_as_ferret :fields => [:title, :body]
Loading development environment.
Content.rebuild_index
NameError: undefined method title' for classComment’
from
./script/…/config/…/config/…/vendor/plugins/acts_as_ferret/lib/a
cts_as_ferret.rb:104:in `method’
I could reproduce the error, but I can’t explain why it happens
I just committed a fix that rescues from the failure and indexes an
empty string for the field in question.
I could reproduce the error, but I can’t explain why it happens
I just committed a fix that rescues from the failure and indexes an
empty string for the field in question.
I could reproduce the error, but I can’t explain why it happens
I just committed a fix that rescues from the failure and indexes an
empty string for the field in question.
It seems the errors are raised when aaf tries to index a
field that isn’t used by the particular model class, i.e. :title in a
Comment object.
Could you please try if the change fixes this for you, too ?
Greetings,
Jens
On Thu, Apr 13, 2006 at 08:13:03PM +0200, Joerg D. wrote:
:title field either … if I were to have :extended as part of the
I could reproduce the error, but I can’t explain why it happens
I just committed a fix that rescues from the failure and indexes an
empty string for the field in question.
It seems the errors are raised when aaf tries to index a
field that isn’t used by the particular model class, i.e. :title in a
Comment object.
I was seeing a similar error on cases where there would be a
single row that had NULL for the value of an indexed field. Rows
before that row would index and then the exception would be
encountered and indexing would stop.
This fix also works for me.
Thanks,
Ray
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.