# Can't find using instance method as field

**URL:** <https://www.ruby-forum.com/t/cant-find-using-instance-method-as-field/111244>\
**Category:** Ferret\
**Created:** [August 4, 2007, 7:17am UTC](https://www.ruby-forum.com/t/cant-find-using-instance-method-as-field/111244 "2007-08-04T07:17:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nobody](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/94ad74/32.png) [@nobody](https://www.ruby-forum.com/u/nobody)\
**Post date:** [August 4, 2007, 7:17am UTC](https://www.ruby-forum.com/t/cant-find-using-instance-method-as-field/111244/1 "2007-08-04T07:17:52Z")

</div>

Hi, I just started experimenting with acts\_as\_ferret. It’s working great  
if I’m searching through database fields through a setup like:

acts\_as\_ferret :fields =\> [‘title’]  
Page.find\_by\_contents(‘Blue’)

But if I try searching through an instance method, I get no results  
back. Anybody know why?

acts\_as\_ferret :fields =\> [‘extra’]  
def extra  
‘Example’  
end

# after deleting the index directory, running “reload!” in the console:

> > Page.find\_by\_contents(‘Example’)  
> > =\> #\<ActsAsFerret::SearchResults:0x2883ba8 @results=[], @total\_hits=0\>

It is reindexing since the development.log has many lines like:  
creating doc for class: Page, id: 9  
Adding field extra with value ‘Example’ to index  
creating doc for class: Page, id: 10  
Adding field extra with value ‘Example’ to index

---

<div class="post-metadata">

**Author:** ![nobody](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/94ad74/32.png) [@nobody](https://www.ruby-forum.com/u/nobody)\
**Post date:** [August 4, 2007, 9:05pm UTC](https://www.ruby-forum.com/t/cant-find-using-instance-method-as-field/111244/2 "2007-08-04T21:05:45Z")

</div>

It seems that I needed to exit and reenter the irb console before  
changes are noticed.
