Skip to content

Instantly share code, notes, and snippets.

@VinSpee
Last active December 11, 2015 10:28
Show Gist options
  • Save VinSpee/4586766 to your computer and use it in GitHub Desktop.
Save VinSpee/4586766 to your computer and use it in GitHub Desktop.
how can I override Backbone.parse to parse this?
define ["backbone", "models/account"], (Backbone, Account) ->
class Account extends Backbone.Model
Account
define ["backbone", "models/account"], (Backbone, Account) ->
class Accounts extends Backbone.Collection
model: Account
parse: (response) ->
response.results
Accounts
[Object]
0: Object
{ "results": [ { "username": "b1service1", "jacket": "0�000", "auth_id": "000", "email": "email@domain.com", "business_channel": "N/A" }, { "username": "b1service2", "jacket": "0001", "auth_id": "0001", "email": "email1@domain.com", "business_channel": "N/A" } } ], "error": null } : Object
collection: Accounts
previousModels: Array[0]
silent: true
__proto__: Object
__proto__: Object
length: 1
__proto__: Array[0]
{
"results": [
{
"username": "b1service1",
"jacket": "000000",
"auth_id": "000",
"email": "email@domain.com",
"business_channel": "N/A",
},
{
"username": "b1service2",
"jacket": "000001",
"auth_id": "001",
"email": "email1@domain.com",
"business_channel": "N/A",
}
],
"error": null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment