Permalink
Browse files

Tweaks primary key behavior in SC.Record#normalize. Fixes bug where i…

…t would fail to identify RecordAttribute subclasses. Closes #1127.
  • Loading branch information...
1 parent bec750c commit 07abb340ce55509c7275ec486b5a47ac30865e8b @dcporter dcporter committed Feb 14, 2014
Showing with 5 additions and 2 deletions.
  1. +5 −2 frameworks/datastore/models/record.js
@@ -635,9 +635,12 @@ SC.Record = SC.Object.extend(
isChild, defaultVal, keyForDataHash, attr;
var dataHash = store.readEditableDataHash(storeKey) || {};
- dataHash[primaryKey] = recordId;
recHash = store.readDataHash(storeKey);
+ // For now we're going to be agnostic about whether ids should live in the
+ // hash or not.
+ keysToKeep[primaryKey] = YES;
+
for (key in this) {
// make sure property is a record attribute.
valueForKey = this[key];
@@ -658,7 +661,7 @@ SC.Record = SC.Object.extend(
if(attrValue!==undefined && (attrValue!==null || includeNull)) {
attr = this[key];
// if record attribute, make sure we transform with the fromType
- if(SC.instanceOf(attr, SC.RecordAttribute)) {
+ if(SC.kindOf(attr, SC.RecordAttribute)) {
attrValue = attr.fromType(this, key, attrValue);
}
dataHash[keyForDataHash] = attrValue;

0 comments on commit 07abb34

Please sign in to comment.