Search on multiple table

Hello,

I am trying to make a search, using acts_as_ferret on a
has_and_belongs_to_many relation :

class a < ActiveRecord::Base
belongs_to :b
has_and_belongs_to_many :c

Joboffer.find_by_contents( query +b_id:1 ) is working fine

but

Joboffer.find_by_contents( query +c:1 ) is not working

Here are the tables descriptions:

Table a have field : id, b_id
Table b have field : id, name
Table c have field : id, name
Table c_a have field :a_id, c_id

Any idea on how to include c on my search ?

On Sat, Dec 30, 2006 at 10:41:04PM +0100, pierre-yves landanger wrote:

Table c_a have field :a_id, c_id

Any idea on how to include c on my search ?

you have to create a method that retrieves the content you want to index
from the c collection belonging to a. Then mention that method name as a
symbol in your field list when you call acts_as_ferret.

Jens


webit! Gesellschaft für neue Medien mbH www.webit.de
Dipl.-Wirtschaftsingenieur Jens Krämer [email protected]
Schnorrstraße 76 Tel +49 351 46766 0
D-01069 Dresden Fax +49 351 46766 66

Thks Jens,

It works fine now
py