should this not be `var ResourceConstructor = this.prototype;`?