Skip to content

Commit

Permalink
Fix typos in SC.Record
Browse files Browse the repository at this point in the history
* Always use a storeKey when calling parentStoreKeyExists
* Fix refresh, commitRecord and destroy to work when recordOnly is false

Refs emberjs-addons#11.
  • Loading branch information
blt04 committed Oct 21, 2011
1 parent 0eaf0f3 commit 41ce89f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/sproutcore-datastore/lib/system/record.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ SC.Record = SC.Object.extend(
refresh: function(recordOnly, callback) {
var store = get(this, 'store'), rec, ro,
sk = get(this, 'storeKey'),
prKey = store.parentStoreKeyExists();
prKey = store.parentStoreKeyExists(sk);

if (!callback && 'function'===typeof recordOnly) {
callback = recordOnly;
Expand All @@ -287,7 +287,7 @@ SC.Record = SC.Object.extend(

// If we only want to refresh this record or it doesn't have a parent
// record we will commit this record
if (recordOnly || (none(recordOnly) && none(prKey))) {
if (recordOnly || none(prKey)) {
store.refreshRecord(null, null, sk, callback);
} else if (prKey) {
rec = store.materializeRecord(prKey);
Expand All @@ -312,11 +312,11 @@ SC.Record = SC.Object.extend(
destroy: function(recordOnly) {
var store = get(this, 'store'), rec, ro,
sk = get(this, 'storeKey'),
prKey = store.parentStoreKeyExists();
prKey = store.parentStoreKeyExists(sk);

// If we only want to destroy this record or it doesn't have a parent
// record we will commit this record
ro = recordOnly || (none(recordOnly) && none(prKey));
ro = recordOnly || none(prKey);
if (ro){
SC.propertyWillChange(this, 'status');
store.destroyRecord(null, null, sk);
Expand Down Expand Up @@ -722,11 +722,11 @@ SC.Record = SC.Object.extend(
commitRecord: function(params, recordOnly, callback) {
var store = get(this, 'store'), rec, ro,
sk = get(this, 'storeKey'),
prKey = store.parentStoreKeyExists();
prKey = store.parentStoreKeyExists(sk);

// If we only want to commit this record or it doesn't have a parent record
// we will commit this record
ro = recordOnly || (SC.none(recordOnly) && SC.none(prKey));
ro = recordOnly || none(prKey);
if (ro){
store.commitRecord(undefined, undefined, get(this, 'storeKey'), params, callback);
} else if (prKey){
Expand Down

0 comments on commit 41ce89f

Please sign in to comment.