difference between render and redirect_to

either

def update     @product = Product.find(params[:id])     if @product.update_attributes(params[:product])       flash[:notice] = 'Product was successfully updated.'

flash.keep and redirect_to :action => 'show', :id => @product and return

    else       render :action => 'edit'     end   end

or

def update     @product = Product.find(params[:id])     if @product.update_attributes(params[:product])       flash[:notice] = 'Product was successfully updated.'

show and render :action => 'show' and return

    else       render :action => 'edit'     end   end

As said before, the second one may be considered better, because it won't affect the client-side navigation. I haven't tested these, sorry if there are some mistakes. You also can use render component, which was created for this purpose, yet somehow deprecated (performance?). For the first solution, don't forget the flash.keep before redirect, and the return after, which is not implied and may become mandatory if you add things after the branch.