:if block never being used/called in acts_as_ferret

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

I’d appreciate your suggestions.

Thanks.

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 :smiley:

Thanks again.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs