{"action":"created","issue":{"url":"https://api.github.com/repos/materik/restberry/issues/4","labels_url":"https://api.github.com/repos/materik/restberry/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/materik/restberry/issues/4/comments","events_url":"https://api.github.com/repos/materik/restberry/issues/4/events","html_url":"https://github.com/materik/restberry/issues/4","id":83457820,"number":4,"title":"Cannot read property 'ref' of undefined","user":{"login":"lobor","id":3316940,"avatar_url":"https://avatars.githubusercontent.com/u/3316940?v=3","gravatar_id":"","url":"https://api.github.com/users/lobor","html_url":"https://github.com/lobor","followers_url":"https://api.github.com/users/lobor/followers","following_url":"https://api.github.com/users/lobor/following{/other_user}","gists_url":"https://api.github.com/users/lobor/gists{/gist_id}","starred_url":"https://api.github.com/users/lobor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lobor/subscriptions","organizations_url":"https://api.github.com/users/lobor/orgs","repos_url":"https://api.github.com/users/lobor/repos","events_url":"https://api.github.com/users/lobor/events{/privacy}","received_events_url":"https://api.github.com/users/lobor/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-01T11:57:10Z","updated_at":"2015-06-01T16:38:59Z","closed_at":null,"body":"Hi,\r\n\r\nI have this schema, \r\n```javascript\r\n{\r\n        name: {\r\n    \t\ttype: String,\r\n    \t\trequired: true,\r\n    \t\tindex: {\r\n    \t\t\tunique: true\r\n    \t\t}\r\n    \t},\r\n        rcs: {\r\n    \t\ttype: Number,\r\n    \t\trequired: true\r\n    \t},\r\n        date_immatriculation: {\r\n    \t\ttype: Date,\r\n    \t\trequired: true\r\n    \t},\r\n        capital: {\r\n    \t\ttype: Number,\r\n    \t\trequired: true\r\n    \t},\r\n        naf: {\r\n    \t\ttype: String,\r\n    \t\trequired: true\r\n    \t},\r\n        adress: {\r\n    \t\ttype: String,\r\n    \t\trequired: true\r\n    \t},\r\n        cp: {\r\n    \t\ttype: Number,\r\n    \t\trequired: true\r\n    \t},\r\n        city: {\r\n    \t\ttype: String,\r\n    \t\trequired: true\r\n    \t},\r\n        nb_part: {\r\n    \t\ttype: Number,\r\n    \t\trequired: true\r\n    \t},\r\n        associes:[{\r\n            nom: {\r\n        \t\ttype: String,\r\n        \t\trequired: true,\r\n        \t},\r\n            prenom: {\r\n        \t\ttype: String,\r\n        \t\trequired: true\r\n        \t},\r\n            address: {\r\n        \t\ttype: String,\r\n        \t\trequired: true\r\n        \t},\r\n            cp : {\r\n                type: Number,\r\n                required: true\r\n            },\r\n            city: {\r\n                type: String,\r\n                required: true\r\n            },\r\n            birthday: {\r\n                type: Date,\r\n                required: true\r\n            },\r\n            city_birthday: {\r\n                type: String,\r\n                required: true\r\n            },\r\n            np_part: {\r\n                type: Number,\r\n                required: true\r\n            },\r\n            percent_part: {\r\n                type: Number,\r\n                required: true\r\n            }\r\n        }]\r\n    }\r\n```\r\n\r\nand when get the data i have this error \r\n```\r\n/Users/lionelbertrand/Documents/locloud/backfront/node_modules/restberry-mongoose/lib/index.js:107\r\n        } else if (field.caster && field.caster.options.ref) {\r\n\r\nTypeError: Cannot read property 'ref' of undefined\r\n    at RestberryMongoose.getFieldsOfModels (/Users/lionelbertrand/Documents/locloud/backfront/node_modules/restberry-mongoose/lib/index.js:107:56)\r\n    at RestberryModel.getFieldsOfModels (/Users/lionelbertrand/Documents/locloud/backfront/node_modules/restberry/lib/model.js:160:24)\r\n    at RestberryModel.getFieldNamesOfModel (/Users/lionelbertrand/Documents/locloud/backfront/node_modules/restberry/lib/model.js:164:10)\r\n    at RestberryObj.__isAuthorized (/Users/lionelbertrand/Documents/locloud/backfront/node_modules/restberry/lib/obj.js:30:20)\r\n    at RestberryObj.isAuthorized (/Users/lionelbertrand/Documents/locloud/backfront/node_modules/restberry/lib/obj.js:110:18)\r\n    at RestberryObj.toJSON (/Users/lionelbertrand/Documents/locloud/backfront/node_modules/restberry/lib/obj.js:249:10)\r\n    at utils.forEachAndDone.json (/Users/lionelbertrand/Documents/locloud/backfront/node_modules/restberry/lib/objs.js:34:13)\r\n    at Object.module.exports.forEachAndDone (/Users/lionelbertrand/Documents/locloud/backfront/node_modules/restberry/node_modules/restberry-utils/lib/index.js:55:13)\r\n    at RestberryObjs.toJSON (/Users/lionelbertrand/Documents/locloud/backfront/node_modules/restberry/lib/objs.js:33:11)\r\n    at /Users/lionelbertrand/Documents/locloud/backfront/node_modules/restberry/node_modules/restberry-router-crud/lib/controller.js:97:26\r\n    at Promise.<anonymous> (/Users/lionelbertrand/Documents/locloud/backfront/node_modules/restberry/lib/model.js:85:13)\r\n    at Promise.<anonymous> (/Users/lionelbertrand/Documents/locloud/backfront/node_modules/restberry-mongoose/node_modules/mongoose/node_modules/mpromise/lib/promise.js:177:8)\r\n    at Promise.emit (events.js:107:17)\r\n    at Promise.emit (/Users/lionelbertrand/Documents/locloud/backfront/node_modules/restberry-mongoose/node_modules/mongoose/node_modules/mpromise/lib/promise.js:84:38)\r\n    at Promise.fulfill (/Users/lionelbertrand/Documents/locloud/backfront/node_modules/restberry-mongoose/node_modules/mongoose/node_modules/mpromise/lib/promise.js:97:20)\r\n    at /Users/lionelbertrand/Documents/locloud/backfront/node_modules/restberry-mongoose/node_modules/mongoose/lib/query.js:1058:26\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/materik/restberry/issues/comments/107630076","html_url":"https://github.com/materik/restberry/issues/4#issuecomment-107630076","issue_url":"https://api.github.com/repos/materik/restberry/issues/4","id":107630076,"user":{"login":"materik","id":2392010,"avatar_url":"https://avatars.githubusercontent.com/u/2392010?v=3","gravatar_id":"","url":"https://api.github.com/users/materik","html_url":"https://github.com/materik","followers_url":"https://api.github.com/users/materik/followers","following_url":"https://api.github.com/users/materik/following{/other_user}","gists_url":"https://api.github.com/users/materik/gists{/gist_id}","starred_url":"https://api.github.com/users/materik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/materik/subscriptions","organizations_url":"https://api.github.com/users/materik/orgs","repos_url":"https://api.github.com/users/materik/repos","events_url":"https://api.github.com/users/materik/events{/privacy}","received_events_url":"https://api.github.com/users/materik/received_events","type":"User","site_admin":false},"created_at":"2015-06-01T16:38:59Z","updated_at":"2015-06-01T16:38:59Z","body":"@lobor Would you mind clearing the node_modules folder and install it again. See if my fix worked for you."}}