# Acts\_as\_ferret Searching child models - no method error

**URL:** <https://www.ruby-forum.com/t/acts-as-ferret-searching-child-models-no-method-error/121069>\
**Category:** Rails\
**Created:** [November 23, 2007, 1:39pm UTC](https://www.ruby-forum.com/t/acts-as-ferret-searching-child-models-no-method-error/121069 "2007-11-23T13:39:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![eddie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/f07891/32.png) [@eddie](https://www.ruby-forum.com/u/eddie)\
**Post date:** [November 23, 2007, 1:39pm UTC](https://www.ruby-forum.com/t/acts-as-ferret-searching-child-models-no-method-error/121069/1 "2007-11-23T13:39:31Z")

</div>

In attempting to search child models (returning the parent object)  
using part of the  
“# Descend child elements” script  
at

> **[Netfirms | This site is temporarily unavailable](http://duncan.beevers.net/?s=all_fields)**
>
> Small business web hosting offering additional business services such as: domain name registrations, email accounts, web services, FrontPage help, online community resources and various small business solutions.

I get a “no method” error for “all\_fields”. Does anyone know why this  
could be or where in fact the method comes from. If it works its a  
good solution unless anyone knows of any another way of searching  
child models while still returning the parent object.

His script is:

# Descend child elements

self.class.reflect\_on\_all\_associations.collect { |association|  
self.send(association.instance\_values[“name”]).collect { |  
child|  
child.to\_doc.all\_fields.collect { |field|  
doc \<\< field  
} if child.class.respond\_to?(“acts\_as\_ferret”)  
}  
}

To use: extend the acts\_as\_ferret to\_doc method by copying it into the  
parent model and add the above code onto the end of it before the  
return of doc.

Incidentally I use the code below instead (hard coding a child model)  
but still have the same problem.

```
self.products.each do |product|
          product.to_doc.all_fields.collect { |field| doc <<

```

field}  
end

I appreciate any help…my deadline looms!  
Eddie
