Note: I know this is wrong, but this is a technical requirement by the server team.
I have a User object that extends Backbone.Model. It receives it’s data using normal, mostly good, JSON from the server.
HOWEVER there is a requirement when saving THE SAME INFORMATION to encode emails with url encoding.
When receiving the data it is possible to pre-process it with the Backbone.Model.parse method, is there an equivalent way to pre-process the data before sending it? (without overriding the sync method)
I overrode Backbone.sync to change the format of the data to form encoded. However, with this method saving attributes that are arrays becomes a problem.
There’s probably a better way to override sync, but I added this code to around line 1180 of the backbone.js file.
Be sure to set Backbone.sendFormEncoded to true for this block of code to run.