On Wed, Apr 18, 2007 at 05:05:49PM +0200, Steven Garcia wrote:
> Hmm, I added your method to my model but am still getting the same  
> errors in my controller action
> 
> With this code, I get undefined method `do_search
> 
> def search
>     search = Search.new(params[:query])
>     @results = search.do_search
>  end
> 
> Which makes no sense at all because in my model I have defined the  
> method
> 
> def self.do_search
>   return multi_search(query, [Article, Term])
> end
> 
> This is beyond weird. Even if my do_search method is not well- 
> written, it should not come up as undefined. Just for laughs i got  
> rid of the "self." part of that method to see what happens. Whaddya  
> know?
> 
> undefined method `multi_search'

so you're one step further now :-)

using 'def self.search' you declared a class method, but we wanted an
instance method, which you declare by omitting the 'self.' .

> This is even stranger. I know that my AAF is loaded correctly because  
> I can do single-model searches no problem. Have I  inadvertently  
> stumbled on a bug?

No, you're just missing the name of the class you call multi_search on
(multi_search is a class method that gets created by aaf in the model
class the acts_as_ferret call is in).

Article.multi_search ...

should finally work ;-)
btw, Term.multi_search will, too, it doesn't matter which of the classes
you pick.

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