var Post = model('Post')
.attr('id')
.attr('title')
.attr('slug')
.attr('content')
.attr('author');
var post = new Post({
title: "My new post",
content: "My awesome post content"
});
post.save(function(err, res) {
post.slug() // undefined
res.body.slug // "my-new-post"
post.author() // undefined
res.body.author // "Cristian Douce"
});
It would be nice to have this kind of sync between model instance and server response object. Now I have to manually set an onsave callback and update model manually with the con of having my model dirty after that. Not nice :(
A use case:
It would be nice to have this kind of sync between model instance and server response object. Now I have to manually set an
onsave
callback and update model manually with the con of having my modeldirty
after that. Not nice :(