Skip to content

Commit

Permalink
Return record after save, sync, reset tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
jdahlq committed Jan 28, 2013
1 parent cf7f1c8 commit 9864253
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions PersistedModel.coffee
Expand Up @@ -61,7 +61,9 @@ class PersistedModel extends Model
console.error("Oh jesus god no:", err)
return cb(err, null)

@id = res.rows[0].id
dbRecord = res.rows[0]
@[key] = val for key, val of dbRecord
@resetChangedAttributeTracking()
console.log "Saved #{@constructor.name}##{@id}:", res
cb(null, res)

Expand All @@ -79,7 +81,7 @@ class PersistedModel extends Model
@db.query new sql.Query()
.insertInto(@tableName)
.values(@attributes)
.returning('id')
.returning('*')
.toString()
, onResult

Expand Down

0 comments on commit 9864253

Please sign in to comment.