On Tue, Apr 24, 2007 at 02:54:27PM +0200, Allen Young wrote:
> John Leach wrote:
> > It does mean that you'll need to reindex the associated Article when a
> > comment is added/updated (an after_save method on your Comment method
> > will do).
> >
> Absolutely. That's why I asked if AAF could do something for us, say add 
> some parameters to acts_as_ferret to delcare the association and AAF 
> would do the after_save thing automatically.

Good point, I'll think about how this could be done. 

Ideally one would only need to specify the relationship itself as a
field, and let aaf rely on the related objects to implement some method
returning the textual content for indexing:

class Article
  has_many :comments
  acts_as_ferret :fields => [ :title , :body, :comments ]
end

class Comment
  belongs_to :article
  def to_ferret
    "#{title} #{body}"
  end
end

Finding out the Comment class from looking at the relationship should be
possible as AR does exactly the same.
What do you think?

Jens

-- 
Jens Krämer
webit! Gesellschaft für neue Medien mbH
Schnorrstraße 76 | 01069 Dresden
Telefon +49 351 46766-0 | Telefax +49 351 46766-66
[EMAIL PROTECTED] | www.webit.de
 
Amtsgericht Dresden | HRB 15422
GF Sven Haubold, Hagen Malessa
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to