{"action":"created","issue":{"url":"https://api.github.com/repos/FineLinePrototyping/angularjs-rails-resource/issues/183","labels_url":"https://api.github.com/repos/FineLinePrototyping/angularjs-rails-resource/issues/183/labels{/name}","comments_url":"https://api.github.com/repos/FineLinePrototyping/angularjs-rails-resource/issues/183/comments","events_url":"https://api.github.com/repos/FineLinePrototyping/angularjs-rails-resource/issues/183/events","html_url":"https://github.com/FineLinePrototyping/angularjs-rails-resource/issues/183","id":118416997,"number":183,"title":"How to mutate manually instantiated object?","user":{"login":"uberspeck","id":857256,"avatar_url":"https://avatars.githubusercontent.com/u/857256?v=3","gravatar_id":"","url":"https://api.github.com/users/uberspeck","html_url":"https://github.com/uberspeck","followers_url":"https://api.github.com/users/uberspeck/followers","following_url":"https://api.github.com/users/uberspeck/following{/other_user}","gists_url":"https://api.github.com/users/uberspeck/gists{/gist_id}","starred_url":"https://api.github.com/users/uberspeck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uberspeck/subscriptions","organizations_url":"https://api.github.com/users/uberspeck/orgs","repos_url":"https://api.github.com/users/uberspeck/repos","events_url":"https://api.github.com/users/uberspeck/events{/privacy}","received_events_url":"https://api.github.com/users/uberspeck/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-11-23T16:21:44Z","updated_at":"2015-11-26T15:28:23Z","closed_at":null,"body":"I'd like to mutate an object when it's instantiated manually (as opposed to a response where I can use an ```interceptor```). Is there a way to make this...\r\n\r\n```javascript\r\n  new User({\r\n    \"first\":\"John\",\r\n    \"middle\":\"P\",\r\n    \"last\":\"Smith\"\r\n  });\r\n```\r\n\r\nreturn this...\r\n\r\n```json\r\n  {\r\n    \"first\":\"John\",\r\n    \"last\":\"Smith\",\r\n    \"full_name\":\"John P. Smith\"\r\n  }\r\n```"},"comment":{"url":"https://api.github.com/repos/FineLinePrototyping/angularjs-rails-resource/issues/comments/159938206","html_url":"https://github.com/FineLinePrototyping/angularjs-rails-resource/issues/183#issuecomment-159938206","issue_url":"https://api.github.com/repos/FineLinePrototyping/angularjs-rails-resource/issues/183","id":159938206,"user":{"login":"uberspeck","id":857256,"avatar_url":"https://avatars.githubusercontent.com/u/857256?v=3","gravatar_id":"","url":"https://api.github.com/users/uberspeck","html_url":"https://github.com/uberspeck","followers_url":"https://api.github.com/users/uberspeck/followers","following_url":"https://api.github.com/users/uberspeck/following{/other_user}","gists_url":"https://api.github.com/users/uberspeck/gists{/gist_id}","starred_url":"https://api.github.com/users/uberspeck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uberspeck/subscriptions","organizations_url":"https://api.github.com/users/uberspeck/orgs","repos_url":"https://api.github.com/users/uberspeck/repos","events_url":"https://api.github.com/users/uberspeck/events{/privacy}","received_events_url":"https://api.github.com/users/uberspeck/received_events","type":"User","site_admin":false},"created_at":"2015-11-26T15:28:23Z","updated_at":"2015-11-26T15:28:23Z","body":"Thanks @tpodom, I hadn't thought of that but I like the solution. There's another variation on this that I run into occasionally where I  need to initialize object/array attributes to prevent write errors. I don't think a setter can be used to solve this though...\r\n\r\n```javascript\r\n    var user = new User({\r\n        permissions: {},\r\n        facilityIds: []\r\n    })\r\n    user.permissions.admin = true;\r\n    user.facilityIds.push(308);\r\n```\r\n\r\nObviously, without initializing the object/array attributes, the following assignments would throw errors. It would be nice if we didn't have to remember to manually add these attributes."}}