redirection problem, passing variables

redirect_to :action => 'edit', :id => @document.id

then you should have the value of @document.id in params[:id] inside
the edit action.