{"action":"created","comment":{"url":"https://api.github.com/repos/mavenlink/brainstem-js/pulls/comments/62360491","id":62360491,"diff_hunk":"@@ -94,14 +139,48 @@ describe 'Brainstem.Model', ->\n       expect(model.fetch()).toEqual(promise)\n \n     describe 'integration', ->\n-      it 'something', ->\n-        task = buildTask()\n-        respondWith(server, '/api/tasks/1', resultsFrom: 'tasks', data: task)\n+      it 'fetches model', ->\n+        updatedModel = buildTask()\n+\n+        respondWith(server, \"/api/tasks/#{model.id}\", resultsFrom: 'tasks', data: updatedModel)\n \n         model.fetch()\n         server.respond()\n \n-        expect(model.attributes).toEqual(task.attributes)\n+        expect(model.attributes).toEqual(updatedModel.attributes)","path":"spec/brainstem-model-spec.coffee","position":91,"original_position":91,"commit_id":"4d97ec378f514e0b9d9e45abd2d32b94f9e5b2a7","original_commit_id":"4d97ec378f514e0b9d9e45abd2d32b94f9e5b2a7","user":{"login":"juanca","id":841084,"avatar_url":"https://avatars.githubusercontent.com/u/841084?v=3","gravatar_id":"","url":"https://api.github.com/users/juanca","html_url":"https://github.com/juanca","followers_url":"https://api.github.com/users/juanca/followers","following_url":"https://api.github.com/users/juanca/following{/other_user}","gists_url":"https://api.github.com/users/juanca/gists{/gist_id}","starred_url":"https://api.github.com/users/juanca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juanca/subscriptions","organizations_url":"https://api.github.com/users/juanca/orgs","repos_url":"https://api.github.com/users/juanca/repos","events_url":"https://api.github.com/users/juanca/events{/privacy}","received_events_url":"https://api.github.com/users/juanca/received_events","type":"User","site_admin":false},"body":"I'm not really sure `model.attributes` was ever different than `updateModel.attributes`","created_at":"2016-05-06T17:19:01Z","updated_at":"2016-05-06T17:19:01Z","html_url":"https://github.com/mavenlink/brainstem-js/pull/74#discussion_r62360491","pull_request_url":"https://api.github.com/repos/mavenlink/brainstem-js/pulls/74","_links":{"self":{"href":"https://api.github.com/repos/mavenlink/brainstem-js/pulls/comments/62360491"},"html":{"href":"https://github.com/mavenlink/brainstem-js/pull/74#discussion_r62360491"},"pull_request":{"href":"https://api.github.com/repos/mavenlink/brainstem-js/pulls/74"}}},"pull_request":{"url":"https://api.github.com/repos/mavenlink/brainstem-js/pulls/74","id":65379396,"html_url":"https://github.com/mavenlink/brainstem-js/pull/74","diff_url":"https://github.com/mavenlink/brainstem-js/pull/74.diff","patch_url":"https://github.com/mavenlink/brainstem-js/pull/74.patch","issue_url":"https://api.github.com/repos/mavenlink/brainstem-js/issues/74","number":74,"state":"open","locked":false,"title":"Cache newly fetched model references in storage manager","user":{"login":"jrolfs","id":288160,"avatar_url":"https://avatars.githubusercontent.com/u/288160?v=3","gravatar_id":"","url":"https://api.github.com/users/jrolfs","html_url":"https://github.com/jrolfs","followers_url":"https://api.github.com/users/jrolfs/followers","following_url":"https://api.github.com/users/jrolfs/following{/other_user}","gists_url":"https://api.github.com/users/jrolfs/gists{/gist_id}","starred_url":"https://api.github.com/users/jrolfs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrolfs/subscriptions","organizations_url":"https://api.github.com/users/jrolfs/orgs","repos_url":"https://api.github.com/users/jrolfs/repos","events_url":"https://api.github.com/users/jrolfs/events{/privacy}","received_events_url":"https://api.github.com/users/jrolfs/received_events","type":"User","site_admin":false},"body":"Fetching a newly instantiated model now results in the new model reference being cached in the storage manager. This allows the reference from instantiation to be used as a canonical reference to the model.\r\n\r\nFixes #71 \r\n\r\nBefore:\r\n\r\n```javascript\r\nvar newModel = new Brainstem.Model();\r\n\r\nmodel.fetch().done(function (model) {\r\n  console.log(model.attributes);\r\n  // fetched attributes\r\n\r\n  console.log(newModel.attributes);\r\n  // {}\r\n\r\n  console.log(model === newModel);\r\n  // false\r\n});\r\n```\r\n\r\nAfter:\r\n\r\n```javascript\r\nvar newModel = new Brainstem.Model();\r\n\r\nmodel.fetch().done(function (model) {\r\n  console.log(model.attributes);\r\n  // fetched attributes\r\n\r\n  console.log(newModel.attributes);\r\n  // fetched attributes\r\n\r\n  console.log(model === newModel);\r\n  // true\r\n});\r\n```","created_at":"2016-04-05T22:11:19Z","updated_at":"2016-05-06T17:19:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"93def5ce0ac71daea7de0848672cbe54e60734f1","assignee":null,"milestone":{"url":"https://api.github.com/repos/mavenlink/brainstem-js/milestones/2","html_url":"https://github.com/mavenlink/brainstem-js/milestones/NPM%20module","labels_url":"https://api.github.com/repos/mavenlink/brainstem-js/milestones/2/labels","id":1709014,"number":2,"title":"NPM module","description":"","creator":{"login":"jrolfs","id":288160,"avatar_url":"https://avatars.githubusercontent.com/u/288160?v=3","gravatar_id":"","url":"https://api.github.com/users/jrolfs","html_url":"https://github.com/jrolfs","followers_url":"https://api.github.com/users/jrolfs/followers","following_url":"https://api.github.com/users/jrolfs/following{/other_user}","gists_url":"https://api.github.com/users/jrolfs/gists{/gist_id}","starred_url":"https://api.github.com/users/jrolfs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrolfs/subscriptions","organizations_url":"https://api.github.com/users/jrolfs/orgs","repos_url":"https://api.github.com/users/jrolfs/repos","events_url":"https://api.github.com/users/jrolfs/events{/privacy}","received_events_url":"https://api.github.com/users/jrolfs/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":1,"state":"open","created_at":"2016-04-15T13:25:48Z","updated_at":"2016-04-15T13:26:45Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/mavenlink/brainstem-js/pulls/74/commits","review_comments_url":"https://api.github.com/repos/mavenlink/brainstem-js/pulls/74/comments","review_comment_url":"https://api.github.com/repos/mavenlink/brainstem-js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mavenlink/brainstem-js/issues/74/comments","statuses_url":"https://api.github.com/repos/mavenlink/brainstem-js/statuses/4d97ec378f514e0b9d9e45abd2d32b94f9e5b2a7","head":{"label":"mavenlink:cache-new-model-references","ref":"cache-new-model-references","sha":"4d97ec378f514e0b9d9e45abd2d32b94f9e5b2a7","user":{"login":"mavenlink","id":52609,"avatar_url":"https://avatars.githubusercontent.com/u/52609?v=3","gravatar_id":"","url":"https://api.github.com/users/mavenlink","html_url":"https://github.com/mavenlink","followers_url":"https://api.github.com/users/mavenlink/followers","following_url":"https://api.github.com/users/mavenlink/following{/other_user}","gists_url":"https://api.github.com/users/mavenlink/gists{/gist_id}","starred_url":"https://api.github.com/users/mavenlink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mavenlink/subscriptions","organizations_url":"https://api.github.com/users/mavenlink/orgs","repos_url":"https://api.github.com/users/mavenlink/repos","events_url":"https://api.github.com/users/mavenlink/events{/privacy}","received_events_url":"https://api.github.com/users/mavenlink/received_events","type":"Organization","site_admin":false},"repo":{"id":7262788,"name":"brainstem-js","full_name":"mavenlink/brainstem-js","owner":{"login":"mavenlink","id":52609,"avatar_url":"https://avatars.githubusercontent.com/u/52609?v=3","gravatar_id":"","url":"https://api.github.com/users/mavenlink","html_url":"https://github.com/mavenlink","followers_url":"https://api.github.com/users/mavenlink/followers","following_url":"https://api.github.com/users/mavenlink/following{/other_user}","gists_url":"https://api.github.com/users/mavenlink/gists{/gist_id}","starred_url":"https://api.github.com/users/mavenlink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mavenlink/subscriptions","organizations_url":"https://api.github.com/users/mavenlink/orgs","repos_url":"https://api.github.com/users/mavenlink/repos","events_url":"https://api.github.com/users/mavenlink/events{/privacy}","received_events_url":"https://api.github.com/users/mavenlink/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mavenlink/brainstem-js","description":"Brainstem API adapter for Backbone complete with relational models","fork":false,"url":"https://api.github.com/repos/mavenlink/brainstem-js","forks_url":"https://api.github.com/repos/mavenlink/brainstem-js/forks","keys_url":"https://api.github.com/repos/mavenlink/brainstem-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mavenlink/brainstem-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mavenlink/brainstem-js/teams","hooks_url":"https://api.github.com/repos/mavenlink/brainstem-js/hooks","issue_events_url":"https://api.github.com/repos/mavenlink/brainstem-js/issues/events{/number}","events_url":"https://api.github.com/repos/mavenlink/brainstem-js/events","assignees_url":"https://api.github.com/repos/mavenlink/brainstem-js/assignees{/user}","branches_url":"https://api.github.com/repos/mavenlink/brainstem-js/branches{/branch}","tags_url":"https://api.github.com/repos/mavenlink/brainstem-js/tags","blobs_url":"https://api.github.com/repos/mavenlink/brainstem-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mavenlink/brainstem-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mavenlink/brainstem-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/mavenlink/brainstem-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mavenlink/brainstem-js/statuses/{sha}","languages_url":"https://api.github.com/repos/mavenlink/brainstem-js/languages","stargazers_url":"https://api.github.com/repos/mavenlink/brainstem-js/stargazers","contributors_url":"https://api.github.com/repos/mavenlink/brainstem-js/contributors","subscribers_url":"https://api.github.com/repos/mavenlink/brainstem-js/subscribers","subscription_url":"https://api.github.com/repos/mavenlink/brainstem-js/subscription","commits_url":"https://api.github.com/repos/mavenlink/brainstem-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/mavenlink/brainstem-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/mavenlink/brainstem-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/mavenlink/brainstem-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/mavenlink/brainstem-js/contents/{+path}","compare_url":"https://api.github.com/repos/mavenlink/brainstem-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mavenlink/brainstem-js/merges","archive_url":"https://api.github.com/repos/mavenlink/brainstem-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mavenlink/brainstem-js/downloads","issues_url":"https://api.github.com/repos/mavenlink/brainstem-js/issues{/number}","pulls_url":"https://api.github.com/repos/mavenlink/brainstem-js/pulls{/number}","milestones_url":"https://api.github.com/repos/mavenlink/brainstem-js/milestones{/number}","notifications_url":"https://api.github.com/repos/mavenlink/brainstem-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mavenlink/brainstem-js/labels{/name}","releases_url":"https://api.github.com/repos/mavenlink/brainstem-js/releases{/id}","deployments_url":"https://api.github.com/repos/mavenlink/brainstem-js/deployments","created_at":"2012-12-20T19:08:54Z","updated_at":"2016-01-15T00:08:59Z","pushed_at":"2016-05-06T02:53:22Z","git_url":"git://github.com/mavenlink/brainstem-js.git","ssh_url":"git@github.com:mavenlink/brainstem-js.git","clone_url":"https://github.com/mavenlink/brainstem-js.git","svn_url":"https://github.com/mavenlink/brainstem-js","homepage":"","size":986,"stargazers_count":22,"watchers_count":22,"language":"CoffeeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":11,"forks":1,"open_issues":11,"watchers":22,"default_branch":"master"}},"base":{"label":"mavenlink:master","ref":"master","sha":"d5177123f025dafaef6ebdc61ee5d32749ecdc90","user":{"login":"mavenlink","id":52609,"avatar_url":"https://avatars.githubusercontent.com/u/52609?v=3","gravatar_id":"","url":"https://api.github.com/users/mavenlink","html_url":"https://github.com/mavenlink","followers_url":"https://api.github.com/users/mavenlink/followers","following_url":"https://api.github.com/users/mavenlink/following{/other_user}","gists_url":"https://api.github.com/users/mavenlink/gists{/gist_id}","starred_url":"https://api.github.com/users/mavenlink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mavenlink/subscriptions","organizations_url":"https://api.github.com/users/mavenlink/orgs","repos_url":"https://api.github.com/users/mavenlink/repos","events_url":"https://api.github.com/users/mavenlink/events{/privacy}","received_events_url":"https://api.github.com/users/mavenlink/received_events","type":"Organization","site_admin":false},"repo":{"id":7262788,"name":"brainstem-js","full_name":"mavenlink/brainstem-js","owner":{"login":"mavenlink","id":52609,"avatar_url":"https://avatars.githubusercontent.com/u/52609?v=3","gravatar_id":"","url":"https://api.github.com/users/mavenlink","html_url":"https://github.com/mavenlink","followers_url":"https://api.github.com/users/mavenlink/followers","following_url":"https://api.github.com/users/mavenlink/following{/other_user}","gists_url":"https://api.github.com/users/mavenlink/gists{/gist_id}","starred_url":"https://api.github.com/users/mavenlink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mavenlink/subscriptions","organizations_url":"https://api.github.com/users/mavenlink/orgs","repos_url":"https://api.github.com/users/mavenlink/repos","events_url":"https://api.github.com/users/mavenlink/events{/privacy}","received_events_url":"https://api.github.com/users/mavenlink/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mavenlink/brainstem-js","description":"Brainstem API adapter for Backbone complete with relational models","fork":false,"url":"https://api.github.com/repos/mavenlink/brainstem-js","forks_url":"https://api.github.com/repos/mavenlink/brainstem-js/forks","keys_url":"https://api.github.com/repos/mavenlink/brainstem-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mavenlink/brainstem-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mavenlink/brainstem-js/teams","hooks_url":"https://api.github.com/repos/mavenlink/brainstem-js/hooks","issue_events_url":"https://api.github.com/repos/mavenlink/brainstem-js/issues/events{/number}","events_url":"https://api.github.com/repos/mavenlink/brainstem-js/events","assignees_url":"https://api.github.com/repos/mavenlink/brainstem-js/assignees{/user}","branches_url":"https://api.github.com/repos/mavenlink/brainstem-js/branches{/branch}","tags_url":"https://api.github.com/repos/mavenlink/brainstem-js/tags","blobs_url":"https://api.github.com/repos/mavenlink/brainstem-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mavenlink/brainstem-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mavenlink/brainstem-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/mavenlink/brainstem-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mavenlink/brainstem-js/statuses/{sha}","languages_url":"https://api.github.com/repos/mavenlink/brainstem-js/languages","stargazers_url":"https://api.github.com/repos/mavenlink/brainstem-js/stargazers","contributors_url":"https://api.github.com/repos/mavenlink/brainstem-js/contributors","subscribers_url":"https://api.github.com/repos/mavenlink/brainstem-js/subscribers","subscription_url":"https://api.github.com/repos/mavenlink/brainstem-js/subscription","commits_url":"https://api.github.com/repos/mavenlink/brainstem-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/mavenlink/brainstem-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/mavenlink/brainstem-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/mavenlink/brainstem-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/mavenlink/brainstem-js/contents/{+path}","compare_url":"https://api.github.com/repos/mavenlink/brainstem-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mavenlink/brainstem-js/merges","archive_url":"https://api.github.com/repos/mavenlink/brainstem-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mavenlink/brainstem-js/downloads","issues_url":"https://api.github.com/repos/mavenlink/brainstem-js/issues{/number}","pulls_url":"https://api.github.com/repos/mavenlink/brainstem-js/pulls{/number}","milestones_url":"https://api.github.com/repos/mavenlink/brainstem-js/milestones{/number}","notifications_url":"https://api.github.com/repos/mavenlink/brainstem-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mavenlink/brainstem-js/labels{/name}","releases_url":"https://api.github.com/repos/mavenlink/brainstem-js/releases{/id}","deployments_url":"https://api.github.com/repos/mavenlink/brainstem-js/deployments","created_at":"2012-12-20T19:08:54Z","updated_at":"2016-01-15T00:08:59Z","pushed_at":"2016-05-06T02:53:22Z","git_url":"git://github.com/mavenlink/brainstem-js.git","ssh_url":"git@github.com:mavenlink/brainstem-js.git","clone_url":"https://github.com/mavenlink/brainstem-js.git","svn_url":"https://github.com/mavenlink/brainstem-js","homepage":"","size":986,"stargazers_count":22,"watchers_count":22,"language":"CoffeeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":11,"forks":1,"open_issues":11,"watchers":22,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mavenlink/brainstem-js/pulls/74"},"html":{"href":"https://github.com/mavenlink/brainstem-js/pull/74"},"issue":{"href":"https://api.github.com/repos/mavenlink/brainstem-js/issues/74"},"comments":{"href":"https://api.github.com/repos/mavenlink/brainstem-js/issues/74/comments"},"review_comments":{"href":"https://api.github.com/repos/mavenlink/brainstem-js/pulls/74/comments"},"review_comment":{"href":"https://api.github.com/repos/mavenlink/brainstem-js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mavenlink/brainstem-js/pulls/74/commits"},"statuses":{"href":"https://api.github.com/repos/mavenlink/brainstem-js/statuses/4d97ec378f514e0b9d9e45abd2d32b94f9e5b2a7"}}}}