> 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])

?



-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to