On Fri, 2006-09-01 at 13:26 +0200, Jens Kraemer wrote:
> there's an instance variable @ferret_reindex that's checked before the
> indexing takes place.
> Something like
> 
> def save_noindex
>   @ferret_reindex = false
>   save
> end
> 
> in your model should save the record without reindexing it. 

This doesn't work because of this code:

def ferret_before_update
  @ferret_reindex = true
end
alias :ferret_before_create :ferret_before_update
        
# add to index
def ferret_create
  logger.debug "ferret_create/update: #{self.class.name} : #{self.id}"
  self.class.ferret_index << self.to_doc if @ferret_reindex
  @ferret_reindex = true
  true
end
alias :ferret_update :ferret_createe

This makes @ferret_reindex always true when ferret_create runs.


> The boolean
> is set to true in the after_save handler again, so the next call to save
> should reindex again. 

I'm guessing the development branch has after_ handlers instead of
before_.

> You may call ferret_update directly to reindex
> without saving, too.

This worked great.

Thanks,

Pedro.

_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to