# :if block never being used/called in acts\_as\_ferret

**URL:** <https://www.ruby-forum.com/t/if-block-never-being-used-called-in-acts-as-ferret/134086>\
**Category:** Ferret\
**Created:** [April 7, 2008, 7:13pm UTC](https://www.ruby-forum.com/t/if-block-never-being-used-called-in-acts-as-ferret/134086 "2008-04-07T19:13:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kylemathews](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/51bf81/32.png) [@kylemathews](https://www.ruby-forum.com/u/kylemathews)\
**Post date:** [April 7, 2008, 7:13pm UTC](https://www.ruby-forum.com/t/if-block-never-being-used-called-in-acts-as-ferret/134086/1 "2008-04-07T19:13:07Z")

</div>

I’m running Ferret 0.11.6-rc7 and trunk acts\_as\_ferret.

Here’s my relevant code from model ‘Agency’:

acts\_as\_ferret :if =\> Proc.new {|agency| agency.do\_index?},  
:store\_class\_name =\> true,  
:fields =\> {  
:name =\> {:store =\> :yes},

…

def do\_index?  
r = 3…5  
rval = r.member?(self.status\_id)  
logger.info “Inside agency.do\_index? returning #{rval.to\_s}”  
return rval  
end

When I rebuild my indexes using a rake task…there’s no logger output.  
Agency’s with status\_id outside of the range are STILL being indexed  
(this is not what I want).

This leads me to believe that A) something isn’t set up and configured  
correctly (aaf or ferret) or B) this code is wrong.

I modeled my code after this example:  
[http://projects.jkraemer.net/acts\_as\_ferret/changeset/324](http://projects.jkraemer.net/acts_as_ferret/changeset/324)

I’d appreciate your suggestions.

Thanks.

---

<div class="post-metadata">

**Author:** ![kylemathews](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/51bf81/32.png) [@kylemathews](https://www.ruby-forum.com/u/kylemathews)\
**Post date:** [April 7, 2008, 7:15pm UTC](https://www.ruby-forum.com/t/if-block-never-being-used-called-in-acts-as-ferret/134086/2 "2008-04-07T19:15:48Z")

</div>

Also, if there are any “gotchas” I should be aware of when using this  
relatively new feature of aaf, I’d love to hear them 😃

Thanks again.
