Ruby Forum Ferret > tutorial multi search with ferret?

Posted by san 1981 (san1981)
on 14.05.2008 17:54
Hello,

I would like to use the plugin act_as_ferret for a multiple search in
different model, I've found some examples on web but only for one model.
Does someone know a nice tutorial for search in multiple models?

Thanks in advance,
Posted by Adam Hill (ado)
on 12.06.2008 03:12
Hi, I don't know of any, but here's a quick example of what to put in 
your controller to get you started (you can also hack through the plugin 
code to work out how it does it):

#we want a paginated list of results for the view:
@results = ActsAsFerret::find(params[:query],
             [Model1, Model2, Model3, Model4],
             #options
             {:page => params[:page], :per_page => 10},
             #active record options (can be empty)
             {:conditions => {:model_1 => "model 1 conditions",
                              :model_2 => "model 2 conditions"
                             }
             }
           )



san 1981 wrote:
> Hello,
> 
> I would like to use the plugin act_as_ferret for a multiple search in
> different model, I've found some examples on web but only for one model.
> Does someone know a nice tutorial for search in multiple models?
> 
> Thanks in advance,