{"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":6,"created_at":"2015-11-23T16:21:44Z","updated_at":"2015-11-29T16:03:56Z","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/160427836","html_url":"https://github.com/FineLinePrototyping/angularjs-rails-resource/issues/183#issuecomment-160427836","issue_url":"https://api.github.com/repos/FineLinePrototyping/angularjs-rails-resource/issues/183","id":160427836,"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-29T16:03:56Z","updated_at":"2015-11-29T16:03:56Z","body":"I tried that initially, but I guess I'm missing something. I used the ```RailsResourceSnapshotsMixin``` as a model and did the following:\r\n\r\n```coffeescript\r\nangular\r\n  .module( \"app.user\" )\r\n  .factory( \"RailsResourceUserDefaultAttributesMixin\", ->\r\n    mixin = ->\r\n    mixin.configure = (config={}) ->\r\n    mixin.extended = (Resource) ->\r\n      Resource.include(\r\n        permissions: {}\r\n        facilityIds: []\r\n      )\r\n    mixin\r\n  )\r\n  .service( \"User\", (RailsResource) ->\r\n    class User extends RailsResource\r\n      @configure\r\n        url: \"/user\"\r\n        name: \"user\"\r\n#         extensions: ['UserDefaultAttributes']\r\n      @extend 'RailsResourceUserDefaultAttributesMixin'\r\n      @resetTerms: ->\r\n        @$post( \"/user/reset_terms\" )\r\n      projects: ->\r\n        User.$get( @$url(\"/project\") )\r\n      acceptTerms: ->\r\n        @termsAccepted = true\r\n        @update()\r\n  )\r\n\r\n```"}}