Permalink
Browse files

Allow end-user devs to set ids on items explicitly.

  • Loading branch information...
1 parent a9ca0f9 commit 94306222efa6f94249374512d47279f1b166ae25 @mde mde committed Aug 1, 2010
Showing with 4 additions and 4 deletions.
  1. +2 −2 geddy-model/lib/adapters/couchdb.js
  2. +2 −2 geddy-model/lib/adapters/sql_base.js
@@ -67,10 +67,10 @@ var adapter = new function () {
// Create track
else {
// Responsibilities of the adapter include:
- // 1. Setting the UUID on the item
+ // 1. Setting the UUID on the item if there's not one already explicitly set
// 2. setting the saved flag before saving
uuid = geddy.util.string.uuid();
- modelItem.id = uuid;
+ modelItem.id = modelItem.id || uuid;
modelItem.saved = true;
}
@@ -52,10 +52,10 @@ var SQLBaseAdapter = function (conn) {
// Create track
else {
// Responsibilities of the adapter include:
- // 1. Setting the UUID on the item
+ // 1. Setting the UUID on the item if there's not one already explicitly set
// 2. setting the saved flag before saving
uuid = geddy.util.string.uuid();
- modelItem.id = uuid;
+ modelItem.id = modelItem.id || uuid;
modelItem.saved = true;
// Serialize item after setting saved flag

0 comments on commit 9430622

Please sign in to comment.