On Thu, Sep 07, 2006 at 11:33:44AM +0100, Pedro Côrte-Real wrote:
> 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.
right, the only way to avoid this seems to be overriding
ferret_beforee_update. I'll have a look into this.
Jens
>
>
> > 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
--
webit! Gesellschaft für neue Medien mbH www.webit.de
Dipl.-Wirtschaftsingenieur Jens Krämer [EMAIL PROTECTED]
Schnorrstraße 76 Tel +49 351 46766 0
D-01069 Dresden Fax +49 351 46766 66
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk