inventid / tails

Models on the fly!
MIT License
1 stars 0 forks source link

save() should allow for using promises #52

Closed rogierslag closed 9 years ago

rogierslag commented 9 years ago

Currently with saving we usually do not (yet) know the id of the new object client side. However, sometimes we need to save and/or update several models, once we persist the first model. In that case, one would like to use the following syntax

item.save().then ->
  child = new App.Models.Child(item_id: item.id)
  child.save()

However, since we have to rely on the Backbone model of promises, code gets really messy (or vulnerable to timing issues).

@steffansluis @joostverdoorn What do you think?

rogierslag commented 9 years ago

Never mind, we can simply use backbone-deferred for this