On Tue, Apr 24, 2007 at 01:43:17PM +0200, Allen Young wrote:
> Hi all,
> 
> I'm quite new to ferret and acts_as_ferret and what to see if I can
> implement the following requirement using them.
> 
> Suppose I have two model classes: Article and Comment. It's obvious that
> one article may have many comments, so this is a one-many relationship.
> If I want to add full text search to these models, I'm supposed to use
> acts_as_ferret in both of the classes.

That depends. If you are not interested in the single comment, but
always want to present the article it belongs to to the user, add a
method to Article that retrieves the contents from all the comments and
index the result of this method along with the article. 
No need for the Comment class to be acts_as_ferret enabled in this case.

Jens

PS: to index the result of an instance method, just specify the method
name as a field in your call to acts_as_ferret, as you would do with any
database backed field.

-- 
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