Skip to content

Instantly share code, notes, and snippets.

@akorchev
Created September 3, 2011 13:02
Show Gist options
  • Save akorchev/1191154 to your computer and use it in GitHub Desktop.
Save akorchev/1191154 to your computer and use it in GitHub Desktop.
Active Record vs Unit of Work
// Active Record
var User = Model.define( {
id: "UserID",
transport: {
create: "create.php"
}
});
var user = new User();
user.set($("form").serialize());
user.save();
// Unit of work
var User = Model.define( {
id: "UserID",
});
var dataSource = new DataSource( {
model: User,
transport: {
create: "create.php"
}
});
var user = new User();
user.set($("form").serialize());
dataSource.add(user);
dataSource.sync();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment