{"comment":{"url":"https://api.github.com/repos/kaxline/telegram-server/comments/9382266","html_url":"https://github.com/kaxline/telegram-server/commit/ac70bde6e677d941e75e78ba06694e6be4d72549#commitcomment-9382266","id":9382266,"user":{"login":"vladberteanu","id":738478,"avatar_url":"https://avatars.githubusercontent.com/u/738478?v=3","gravatar_id":"","url":"https://api.github.com/users/vladberteanu","html_url":"https://github.com/vladberteanu","followers_url":"https://api.github.com/users/vladberteanu/followers","following_url":"https://api.github.com/users/vladberteanu/following{/other_user}","gists_url":"https://api.github.com/users/vladberteanu/gists{/gist_id}","starred_url":"https://api.github.com/users/vladberteanu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vladberteanu/subscriptions","organizations_url":"https://api.github.com/users/vladberteanu/orgs","repos_url":"https://api.github.com/users/vladberteanu/repos","events_url":"https://api.github.com/users/vladberteanu/events{/privacy}","received_events_url":"https://api.github.com/users/vladberteanu/received_events","type":"User","site_admin":false},"position":15,"line":15,"path":"schemas/user.js","commit_id":"ac70bde6e677d941e75e78ba06694e6be4d72549","created_at":"2015-01-21T19:09:02Z","updated_at":"2015-01-21T19:09:02Z","body":"toEmber function should be attached to userSchema.methods.\r\n\r\n```javascript\r\nuserSchema.methods.toEmber = function() {\r\n  // this is a reference to the user object\r\n // this.id, this.name etc\r\n}\r\n```\r\n\r\nAnd when you need the method you call it on the user object not user model.\r\n\r\n```javascript\r\nres.send({user: user.toEmber()});\r\n```"}}