Hi Mischa!

On Wed, Feb 28, 2007 at 09:58:18PM +0100, Mischa Berger wrote:
> Hello everyone,
> 
> I'm using multi-search to search in some attributes of two classes. One
> of the attributes is the id of the customer. For each multi_search I
> want to do a give the id of the current customer as a parameter. This
> should only return results for the given customer.
> 
> My current code looks like this:
> 
> Folder.multi_search(@search_query, [Myfile])
> 
> I noticed in the API you can add options and find_options to this. How
> do I use these parameters, so only results for a certain customer are
> returned?

With aaf trunk you can do

Folder.multi_search(@search_query, [Myfile], {}, { :conditions => [ 
"customer_id=?", @customer.id ] })

As there's no way to specify per-model find_options, you need a
customer_id field in both models, MyFile and Folder. However it would
not be that hard to add a model dimension to the find_options hash for
multi_search (patches welcome ;-).

aaf 0.3.1 (stable) doesn't support find_options with multi_search.

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