您不能再在towerjs的当前开发分支中设置特定ID。
你知道有没有办法做到这一点?
我似乎无法做到:
data =
id: "123456asdasd"
name: "Foo"
App.User.create data, (err, resource) =>
console.log resource.get("id")
resource.set "id", data.id
resource.save() # doesn't work
答案 0 :(得分:0)
我找到了解决方案:
您可以指定如下ID:
data =
id: "123456asd"
name: "Foo"
record = App.User.build data
record.set "_id", data.id
record.save =>
console.log record.get("id")