On Thu, Nov 30, 2006 at 06:35:54PM +0100, Matthew Planchant wrote: > > > imho it would be better to not call update_attributes in this place, as > > you already saved the document inside the block above. It's one line > > more for the explicit call to ferret_update but should save you one > > update call to your DB. > > > > so instead of this: > >> if @document.update_attributes(params[:document]) > > > > this should work, too: > > > > if @document.valid? > > @document.ferret_update > >> flash[:notice] = 'Document was successfully updated.' > >> redirect_to :action => 'show', :id => @document > >> else > >> render :action => 'edit' > >> end > >> end > > > > you could even store the return value from the save call inside the > > block and use that in the if statement... > > Thanks for the reply Jens. > > Is this because: > > @document.attributes = params[:document] > > does the same as: > > @document.update_attributes(params[:document])
nearly ;-) @document.attributes = params[:document] @document.save does the same as @document.update_attributes(params[:document]) Jens -- 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

