anchor.diff:      {true, Req, State};
   resource_exists(Req, State = #state{mode = document, path_info = id}) ->
       Context = State#state.context,
  -    Id = wrq:path_info(id, Req),
  -    {m_rsc:exists(Id, Context), Req, State};
  +    {m_rsc:exists(State#state.document_id, Context), Req, State};
   resource_exists(Req, State = #state{mode = document, path_info = path}) ->
       Context = State#state.context,
       case path_to_id(wrq:path_info(path, Req), Context) of
  
positive.code:     case string:to_integer(wrq:path_info(id, Req)) of
          {error, _Reason} ->
              {true, Req, State};
          {_Int, []} ->
              {false, Req, State};
          {_Int, _Rest} ->
              {true, Req, State}
      end;
  
negative.code: -record(state, { mode = undefined
                 , path_info = undefined
                 , context = undefined
                 , document_id = undefined
                 }
         ).
  
  