Is it possible to make Backbone.js work with compound keys?
Id est, instead of setting id
or idAttributemodel
to a specific value, I want to know Backbone.js that I will be using more than one property. In such a way, every RESTful call would be made sending those two parameters to identify the object we're talking about.
For the sake of an example, let's say that I want to update a person's debt to a specific person, and the model is:
Borrower (borrowerId, name, ...)
Lender (lenderId, name, ...)
Debt (borrowerId, lenderId, debtAmount)
So, I now want to make Backbone.js update/delete a debt object. How can I make it work with the compound key (borrowerId, lenderId)
?