{"action":"created","comment":{"url":"https://api.github.com/repos/emberjs/data/pulls/comments/31472327","id":31472327,"diff_hunk":"@@ -0,0 +1,696 @@\n+import merge from \"ember-data/system/merge\";\n+import RootState from \"ember-data/system/model/states\";\n+import createRelationshipFor from \"ember-data/system/relationships/state/create\";\n+import Snapshot from \"ember-data/system/snapshot\";\n+import Errors from \"ember-data/system/model/errors\";\n+\n+var Promise = Ember.RSVP.Promise;\n+var get = Ember.get;\n+var set = Ember.set;\n+var forEach = Ember.ArrayPolyfills.forEach;\n+var map = Ember.ArrayPolyfills.map;\n+\n+var _extractPivotNameCache = Ember.create(null);\n+var _splitOnDotCache = Ember.create(null);\n+\n+function splitOnDot(name) {\n+  return _splitOnDotCache[name] || (\n+    _splitOnDotCache[name] = name.split('.')\n+  );\n+}\n+\n+function extractPivotName(name) {\n+  return _extractPivotNameCache[name] || (\n+    _extractPivotNameCache[name] = splitOnDot(name)[0]\n+  );\n+}\n+\n+function retrieveFromCurrentState(key) {\n+  return function() {\n+    return get(this.currentState, key);\n+  };\n+}\n+\n+/*\n+  `InternalModel` is the Model class that we use internally inside Ember Data to represent models.\n+  Internal ED methods should only deal with `InternalModel` objects. It is a fast, plain Javascript class.\n+\n+  We expose `DS.Model` to application code, by materializing a `DS.Model` from `InternalModel` lazily, as\n+  a performance optimization.\n+\n+  `InternalModel` should never be exposed to application code. At the boundaries of the system, in places\n+  like `find`, `push`, etc. we convert between Models and InternalModels.\n+\n+  We need to make sure that the properties from `InternalModel` are correctly exposed/proxied on `Model`\n+  if they are needed.\n+*/\n+\n+var InternalModel = function(type, id, store, container, data) {\n+  this.type = type;\n+  this.id = id;\n+  this.store = store;\n+  this.container = container;\n+  this._data = data || {};\n+  this.modelName = type.modelName;\n+  this.errors = null;\n+  this.dataHasInitialized = false;\n+  this._deferredTriggers = [];","path":"packages/ember-data/lib/system/model/internal-model.js","position":57,"original_position":57,"commit_id":"cf1b2d5c15804523bf3053137e73337f1374e18c","original_commit_id":"cf1b2d5c15804523bf3053137e73337f1374e18c","user":{"login":"stefanpenner","id":1377,"avatar_url":"https://avatars.githubusercontent.com/u/1377?v=3","gravatar_id":"","url":"https://api.github.com/users/stefanpenner","html_url":"https://github.com/stefanpenner","followers_url":"https://api.github.com/users/stefanpenner/followers","following_url":"https://api.github.com/users/stefanpenner/following{/other_user}","gists_url":"https://api.github.com/users/stefanpenner/gists{/gist_id}","starred_url":"https://api.github.com/users/stefanpenner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stefanpenner/subscriptions","organizations_url":"https://api.github.com/users/stefanpenner/orgs","repos_url":"https://api.github.com/users/stefanpenner/repos","events_url":"https://api.github.com/users/stefanpenner/events{/privacy}","received_events_url":"https://api.github.com/users/stefanpenner/received_events","type":"User","site_admin":false},"body":"in theory, if any of:\r\n\r\n* this._deferredTriggers\r\n* this._attributes = Ember.create(null);\r\n* this._inFlightAttributes = Ember.create(null);\r\n* this._relationships = {};\r\n\r\nare not always needed on init, making them lazy would increase the alloc/s of this object. note, only do this if they are in-fact not always needed on init.\r\n","created_at":"2015-06-01T21:26:48Z","updated_at":"2015-06-01T21:26:48Z","html_url":"https://github.com/emberjs/data/pull/3094#discussion_r31472327","pull_request_url":"https://api.github.com/repos/emberjs/data/pulls/3094","_links":{"self":{"href":"https://api.github.com/repos/emberjs/data/pulls/comments/31472327"},"html":{"href":"https://github.com/emberjs/data/pull/3094#discussion_r31472327"},"pull_request":{"href":"https://api.github.com/repos/emberjs/data/pulls/3094"}}},"pull_request":{"url":"https://api.github.com/repos/emberjs/data/pulls/3094","id":36104525,"html_url":"https://github.com/emberjs/data/pull/3094","diff_url":"https://github.com/emberjs/data/pull/3094.diff","patch_url":"https://github.com/emberjs/data/pull/3094.patch","issue_url":"https://api.github.com/repos/emberjs/data/issues/3094","number":3094,"state":"open","locked":false,"title":"Lazily materialize DS.Models for app code, use InternalModel inside ED otherwise","user":{"login":"igorT","id":715175,"avatar_url":"https://avatars.githubusercontent.com/u/715175?v=3","gravatar_id":"","url":"https://api.github.com/users/igorT","html_url":"https://github.com/igorT","followers_url":"https://api.github.com/users/igorT/followers","following_url":"https://api.github.com/users/igorT/following{/other_user}","gists_url":"https://api.github.com/users/igorT/gists{/gist_id}","starred_url":"https://api.github.com/users/igorT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/igorT/subscriptions","organizations_url":"https://api.github.com/users/igorT/orgs","repos_url":"https://api.github.com/users/igorT/repos","events_url":"https://api.github.com/users/igorT/events{/privacy}","received_events_url":"https://api.github.com/users/igorT/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-05-24T16:08:09Z","updated_at":"2015-06-01T21:26:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d9d897b798e495bed478c53caa8e3936a2526d23","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/emberjs/data/pulls/3094/commits","review_comments_url":"https://api.github.com/repos/emberjs/data/pulls/3094/comments","review_comment_url":"https://api.github.com/repos/emberjs/data/pulls/comments{/number}","comments_url":"https://api.github.com/repos/emberjs/data/issues/3094/comments","statuses_url":"https://api.github.com/repos/emberjs/data/statuses/cf1b2d5c15804523bf3053137e73337f1374e18c","head":{"label":"emberjs:references","ref":"references","sha":"cf1b2d5c15804523bf3053137e73337f1374e18c","user":{"login":"emberjs","id":1253363,"avatar_url":"https://avatars.githubusercontent.com/u/1253363?v=3","gravatar_id":"","url":"https://api.github.com/users/emberjs","html_url":"https://github.com/emberjs","followers_url":"https://api.github.com/users/emberjs/followers","following_url":"https://api.github.com/users/emberjs/following{/other_user}","gists_url":"https://api.github.com/users/emberjs/gists{/gist_id}","starred_url":"https://api.github.com/users/emberjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emberjs/subscriptions","organizations_url":"https://api.github.com/users/emberjs/orgs","repos_url":"https://api.github.com/users/emberjs/repos","events_url":"https://api.github.com/users/emberjs/events{/privacy}","received_events_url":"https://api.github.com/users/emberjs/received_events","type":"Organization","site_admin":false},"repo":{"id":3016562,"name":"data","full_name":"emberjs/data","owner":{"login":"emberjs","id":1253363,"avatar_url":"https://avatars.githubusercontent.com/u/1253363?v=3","gravatar_id":"","url":"https://api.github.com/users/emberjs","html_url":"https://github.com/emberjs","followers_url":"https://api.github.com/users/emberjs/followers","following_url":"https://api.github.com/users/emberjs/following{/other_user}","gists_url":"https://api.github.com/users/emberjs/gists{/gist_id}","starred_url":"https://api.github.com/users/emberjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emberjs/subscriptions","organizations_url":"https://api.github.com/users/emberjs/orgs","repos_url":"https://api.github.com/users/emberjs/repos","events_url":"https://api.github.com/users/emberjs/events{/privacy}","received_events_url":"https://api.github.com/users/emberjs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/emberjs/data","description":"A data persistence library for Ember.js.","fork":false,"url":"https://api.github.com/repos/emberjs/data","forks_url":"https://api.github.com/repos/emberjs/data/forks","keys_url":"https://api.github.com/repos/emberjs/data/keys{/key_id}","collaborators_url":"https://api.github.com/repos/emberjs/data/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/emberjs/data/teams","hooks_url":"https://api.github.com/repos/emberjs/data/hooks","issue_events_url":"https://api.github.com/repos/emberjs/data/issues/events{/number}","events_url":"https://api.github.com/repos/emberjs/data/events","assignees_url":"https://api.github.com/repos/emberjs/data/assignees{/user}","branches_url":"https://api.github.com/repos/emberjs/data/branches{/branch}","tags_url":"https://api.github.com/repos/emberjs/data/tags","blobs_url":"https://api.github.com/repos/emberjs/data/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/emberjs/data/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/emberjs/data/git/refs{/sha}","trees_url":"https://api.github.com/repos/emberjs/data/git/trees{/sha}","statuses_url":"https://api.github.com/repos/emberjs/data/statuses/{sha}","languages_url":"https://api.github.com/repos/emberjs/data/languages","stargazers_url":"https://api.github.com/repos/emberjs/data/stargazers","contributors_url":"https://api.github.com/repos/emberjs/data/contributors","subscribers_url":"https://api.github.com/repos/emberjs/data/subscribers","subscription_url":"https://api.github.com/repos/emberjs/data/subscription","commits_url":"https://api.github.com/repos/emberjs/data/commits{/sha}","git_commits_url":"https://api.github.com/repos/emberjs/data/git/commits{/sha}","comments_url":"https://api.github.com/repos/emberjs/data/comments{/number}","issue_comment_url":"https://api.github.com/repos/emberjs/data/issues/comments{/number}","contents_url":"https://api.github.com/repos/emberjs/data/contents/{+path}","compare_url":"https://api.github.com/repos/emberjs/data/compare/{base}...{head}","merges_url":"https://api.github.com/repos/emberjs/data/merges","archive_url":"https://api.github.com/repos/emberjs/data/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/emberjs/data/downloads","issues_url":"https://api.github.com/repos/emberjs/data/issues{/number}","pulls_url":"https://api.github.com/repos/emberjs/data/pulls{/number}","milestones_url":"https://api.github.com/repos/emberjs/data/milestones{/number}","notifications_url":"https://api.github.com/repos/emberjs/data/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/emberjs/data/labels{/name}","releases_url":"https://api.github.com/repos/emberjs/data/releases{/id}","created_at":"2011-12-20T01:50:40Z","updated_at":"2015-06-01T14:51:29Z","pushed_at":"2015-06-01T20:21:14Z","git_url":"git://github.com/emberjs/data.git","ssh_url":"git@github.com:emberjs/data.git","clone_url":"https://github.com/emberjs/data.git","svn_url":"https://github.com/emberjs/data","homepage":"","size":28351,"stargazers_count":2373,"watchers_count":2373,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":906,"mirror_url":null,"open_issues_count":237,"forks":906,"open_issues":237,"watchers":2373,"default_branch":"master"}},"base":{"label":"emberjs:master","ref":"master","sha":"09809f3cbf2256e7f3c3330d37a60c5d5ba5ad9d","user":{"login":"emberjs","id":1253363,"avatar_url":"https://avatars.githubusercontent.com/u/1253363?v=3","gravatar_id":"","url":"https://api.github.com/users/emberjs","html_url":"https://github.com/emberjs","followers_url":"https://api.github.com/users/emberjs/followers","following_url":"https://api.github.com/users/emberjs/following{/other_user}","gists_url":"https://api.github.com/users/emberjs/gists{/gist_id}","starred_url":"https://api.github.com/users/emberjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emberjs/subscriptions","organizations_url":"https://api.github.com/users/emberjs/orgs","repos_url":"https://api.github.com/users/emberjs/repos","events_url":"https://api.github.com/users/emberjs/events{/privacy}","received_events_url":"https://api.github.com/users/emberjs/received_events","type":"Organization","site_admin":false},"repo":{"id":3016562,"name":"data","full_name":"emberjs/data","owner":{"login":"emberjs","id":1253363,"avatar_url":"https://avatars.githubusercontent.com/u/1253363?v=3","gravatar_id":"","url":"https://api.github.com/users/emberjs","html_url":"https://github.com/emberjs","followers_url":"https://api.github.com/users/emberjs/followers","following_url":"https://api.github.com/users/emberjs/following{/other_user}","gists_url":"https://api.github.com/users/emberjs/gists{/gist_id}","starred_url":"https://api.github.com/users/emberjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emberjs/subscriptions","organizations_url":"https://api.github.com/users/emberjs/orgs","repos_url":"https://api.github.com/users/emberjs/repos","events_url":"https://api.github.com/users/emberjs/events{/privacy}","received_events_url":"https://api.github.com/users/emberjs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/emberjs/data","description":"A data persistence library for Ember.js.","fork":false,"url":"https://api.github.com/repos/emberjs/data","forks_url":"https://api.github.com/repos/emberjs/data/forks","keys_url":"https://api.github.com/repos/emberjs/data/keys{/key_id}","collaborators_url":"https://api.github.com/repos/emberjs/data/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/emberjs/data/teams","hooks_url":"https://api.github.com/repos/emberjs/data/hooks","issue_events_url":"https://api.github.com/repos/emberjs/data/issues/events{/number}","events_url":"https://api.github.com/repos/emberjs/data/events","assignees_url":"https://api.github.com/repos/emberjs/data/assignees{/user}","branches_url":"https://api.github.com/repos/emberjs/data/branches{/branch}","tags_url":"https://api.github.com/repos/emberjs/data/tags","blobs_url":"https://api.github.com/repos/emberjs/data/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/emberjs/data/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/emberjs/data/git/refs{/sha}","trees_url":"https://api.github.com/repos/emberjs/data/git/trees{/sha}","statuses_url":"https://api.github.com/repos/emberjs/data/statuses/{sha}","languages_url":"https://api.github.com/repos/emberjs/data/languages","stargazers_url":"https://api.github.com/repos/emberjs/data/stargazers","contributors_url":"https://api.github.com/repos/emberjs/data/contributors","subscribers_url":"https://api.github.com/repos/emberjs/data/subscribers","subscription_url":"https://api.github.com/repos/emberjs/data/subscription","commits_url":"https://api.github.com/repos/emberjs/data/commits{/sha}","git_commits_url":"https://api.github.com/repos/emberjs/data/git/commits{/sha}","comments_url":"https://api.github.com/repos/emberjs/data/comments{/number}","issue_comment_url":"https://api.github.com/repos/emberjs/data/issues/comments{/number}","contents_url":"https://api.github.com/repos/emberjs/data/contents/{+path}","compare_url":"https://api.github.com/repos/emberjs/data/compare/{base}...{head}","merges_url":"https://api.github.com/repos/emberjs/data/merges","archive_url":"https://api.github.com/repos/emberjs/data/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/emberjs/data/downloads","issues_url":"https://api.github.com/repos/emberjs/data/issues{/number}","pulls_url":"https://api.github.com/repos/emberjs/data/pulls{/number}","milestones_url":"https://api.github.com/repos/emberjs/data/milestones{/number}","notifications_url":"https://api.github.com/repos/emberjs/data/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/emberjs/data/labels{/name}","releases_url":"https://api.github.com/repos/emberjs/data/releases{/id}","created_at":"2011-12-20T01:50:40Z","updated_at":"2015-06-01T14:51:29Z","pushed_at":"2015-06-01T20:21:14Z","git_url":"git://github.com/emberjs/data.git","ssh_url":"git@github.com:emberjs/data.git","clone_url":"https://github.com/emberjs/data.git","svn_url":"https://github.com/emberjs/data","homepage":"","size":28351,"stargazers_count":2373,"watchers_count":2373,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":906,"mirror_url":null,"open_issues_count":237,"forks":906,"open_issues":237,"watchers":2373,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/emberjs/data/pulls/3094"},"html":{"href":"https://github.com/emberjs/data/pull/3094"},"issue":{"href":"https://api.github.com/repos/emberjs/data/issues/3094"},"comments":{"href":"https://api.github.com/repos/emberjs/data/issues/3094/comments"},"review_comments":{"href":"https://api.github.com/repos/emberjs/data/pulls/3094/comments"},"review_comment":{"href":"https://api.github.com/repos/emberjs/data/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/emberjs/data/pulls/3094/commits"},"statuses":{"href":"https://api.github.com/repos/emberjs/data/statuses/cf1b2d5c15804523bf3053137e73337f1374e18c"}}}}