docs: function(RestClass, rest_classes, methods) {
    /* Given a RestClass, set its prototype */
    RestClass.prototype = {
      Class: RestClass,
      delete_: function(callback, fallback){
        RestClass.delete_({ids: [this.id]}, callback, fallback);
      },
      update: function(args) {
        args.ids = [this.id];
        RestClass.update(args);
      },
      unlink: function(){return unlink_references(this)},
      json: function() {
        var base = {};
        utils.extend(base, this.unlink());
        return base;
      },
      save: function(callback, fallback) {
        /* Save the obj to DB, creating it if necessary.
         *
         * Arguments:
         *  - callback(obj): to be called once the object has been saved/inserted.
         *  - fallback(err): to be called in case of error.
         */
        var obj = this;
        if('id' in obj) { // The object already exist: use update
          return RestClass.update({ids: [obj.id],
                                   data: obj.unlink()
                                   }, callback, fallback);
        }
        // The object has no id, it really is a new one, so insert:
        RestClass.insert({obj: obj}, callback, fallback);
      },
      _update: function(data){
        /* Update the object with the given data, no request is made: no save.
         * The [list of] references are changed for references to real objects
         * */
        link_references(data, RestClass.schema.id, rest_classes);
        return utils.extend(this, data);
      },
      refresh: function(callback, fallback){
        /* Reload the object with values from DB.
         * Current values won't be saved.
         *
         * Arguments:
         *  - callback(obj): function to be called once the obj has been reloaded
         *  - fallback(err): function to be called in case of error
         */
        RestClass.get({ids: [this.id],
                       force_reload: true
                       }, callback, fallback);
      },
    };
    utils.extend(RestClass.prototype, methods);
  }