# Prevent index auto update

**URL:** <https://www.ruby-forum.com/t/prevent-index-auto-update/91620>\
**Category:** Ferret\
**Created:** [April 10, 2007, 9:59pm UTC](https://www.ruby-forum.com/t/prevent-index-auto-update/91620 "2007-04-10T21:59:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ericgoodwin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/c68b51/32.png) [@ericgoodwin](https://www.ruby-forum.com/u/ericgoodwin)\
**Post date:** [April 10, 2007, 9:59pm UTC](https://www.ruby-forum.com/t/prevent-index-auto-update/91620/1 "2007-04-10T21:59:08Z")

</div>

Hi,

I have a has\_many association between Book and Page.

I have acts\_as\_ferret running on only the Book model. However, when I  
update the a page, it calls the auto update index on the Book model as  
well just in case any of the ferret fields were changed.

How can I stop acts\_as\_ferret from auto updating the index on its own,  
especially when nothing changes?

---

<div class="post-metadata">

**Author:** ![ericgoodwin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/c68b51/32.png) [@ericgoodwin](https://www.ruby-forum.com/u/ericgoodwin)\
**Post date:** [April 10, 2007, 10:42pm UTC](https://www.ruby-forum.com/t/prevent-index-auto-update/91620/2 "2007-04-10T22:42:19Z")

</div>

On Tue, Apr 10, 2007 at 09:59:08PM +0200, Aryk G. wrote:

> Hi,
> 
> I have a has\_many association between Book and Page.
> 
> I have acts\_as\_ferret running on only the Book model. However, when I  
> update the a page, it calls the auto update index on the Book model as  
> well just in case any of the ferret fields were changed.

the book index will only be updated if a book record is saved. To save a  
book record without updating the ferret index, look at the  
ferret\_disable method aaf mixes into your book model, or into the wiki:  
[http://projects.jkraemer.net/acts\_as\_ferret/wiki/AdvancedUsage#Disablingautomaticindexing](http://projects.jkraemer.net/acts_as_ferret/wiki/AdvancedUsage#Disablingautomaticindexing)

As an alternative, If you want a completely custom handling of when aaf  
does automatic index updates and when not, just override the  
ferret\_enabled? instance method in your book model to return true only  
if you want automatic indexing and false otherwise.

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  
removed\_email\_address@domain.invalid | [www.webit.de](http://www.webit.de)

Amtsgericht Dresden | HRB 15422  
GF Sven Haubold, Hagen Malessa
