Forum: Ferret search on multiple table

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
pierre-yves landanger (Guest)
on 2006-12-30 23:41

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


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 ?
Jens K. (Guest)
on 2006-12-31 17:58
(Received via mailing list)
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.


webit! Gesellschaft für neue Medien mbH
Dipl.-Wirtschaftsingenieur Jens Krämer 
Schnorrstraße 76                         Tel +49 351 46766  0
D-01069 Dresden                          Fax +49 351 46766 66
Guest (Guest)
on 2007-01-01 19:11
Thks Jens,

It works fine now
This topic is locked and can not be replied to.